| .. | .. | 
|---|
| 104 | 104 |          double t1 = (min.x - ray.eyePoint.x) / ray.viewDirection.x; | 
|---|
| 105 | 105 |          double t2 = (max.x - ray.eyePoint.x) / ray.viewDirection.x; | 
|---|
| 106 | 106 |   | 
|---|
| 107 |  | -        double mint = t1;  | 
|---|
| 108 |  | -        if (mint > t2) mint = t2;  | 
|---|
| 109 |  | -          | 
|---|
| 110 |  | -        double maxt = t1;  | 
|---|
| 111 |  | -        if (maxt < t2) maxt = t2;  | 
|---|
| 112 |  | -          | 
|---|
| 113 | 107 |          if (ray.viewDirection.x == 0) | 
|---|
| 114 | 108 |          { | 
|---|
| 115 | 109 |              if (ray.eyePoint.x <= min.x || ray.eyePoint.x >= max.x) | 
|---|
| .. | .. | 
|---|
| 117 | 111 |          } | 
|---|
| 118 | 112 |          else | 
|---|
| 119 | 113 |          { | 
|---|
| 120 |  | -            if (tmin > mint) tmin = mint;  | 
|---|
| 121 |  | -            if (tmax < maxt) tmax = maxt;  | 
|---|
| 122 |  | -        }  | 
|---|
| 123 |  | -          | 
|---|
| 124 |  | -        t1 = (min.y - ray.eyePoint.y) / ray.viewDirection.y;  | 
|---|
| 125 |  | -        t2 = (max.y - ray.eyePoint.y) / ray.viewDirection.y;  | 
|---|
 | 114 | +            if (t1 > t2)  | 
|---|
 | 115 | +            {  | 
|---|
 | 116 | +                double t = t1;  | 
|---|
 | 117 | +                t1 = t2;  | 
|---|
 | 118 | +                t2 = t;  | 
|---|
 | 119 | +            }  | 
|---|
| 126 | 120 |   | 
|---|
| 127 |  | -        mint = t1;  | 
|---|
| 128 |  | -        if (mint > t2) mint = t2;  | 
|---|
| 129 |  | -          | 
|---|
| 130 |  | -        maxt = t1;  | 
|---|
| 131 |  | -        if (maxt < t2) maxt = t2;  | 
|---|
 | 121 | +            if (tmin > t1) tmin = t1;  | 
|---|
 | 122 | +            if (tmax < t2) tmax = t2;  | 
|---|
 | 123 | +        }  | 
|---|
| 132 | 124 |           | 
|---|
| 133 | 125 |          if (ray.viewDirection.y == 0) | 
|---|
| 134 | 126 |          { | 
|---|
| .. | .. | 
|---|
| 137 | 129 |          } | 
|---|
| 138 | 130 |          else | 
|---|
| 139 | 131 |          { | 
|---|
| 140 |  | -            if (tmin > mint) tmin = mint;  | 
|---|
| 141 |  | -            if (tmax < maxt) tmax = maxt;  | 
|---|
| 142 |  | -        }  | 
|---|
| 143 |  | -          | 
|---|
| 144 |  | -        t1 = (min.z - ray.eyePoint.z) / ray.viewDirection.z;  | 
|---|
| 145 |  | -        t2 = (max.z - ray.eyePoint.z) / ray.viewDirection.z;  | 
|---|
 | 132 | +            t1 = (min.y - ray.eyePoint.y) / ray.viewDirection.y;  | 
|---|
 | 133 | +            t2 = (max.y - ray.eyePoint.y) / ray.viewDirection.y;  | 
|---|
| 146 | 134 |   | 
|---|
| 147 |  | -        mint = t1;  | 
|---|
| 148 |  | -        if (mint > t2) mint = t2;  | 
|---|
| 149 |  | -          | 
|---|
| 150 |  | -        maxt = t1;  | 
|---|
| 151 |  | -        if (maxt < t2) maxt = t2;  | 
|---|
 | 135 | +            if (t1 > t2)  | 
|---|
 | 136 | +            {  | 
|---|
 | 137 | +                double t = t1;  | 
|---|
 | 138 | +                t1 = t2;  | 
|---|
 | 139 | +                t2 = t;  | 
|---|
 | 140 | +            }  | 
|---|
 | 141 | +  | 
|---|
 | 142 | +            if (tmin > t1) tmin = t1;  | 
|---|
 | 143 | +            if (tmax < t2) tmax = t2;  | 
|---|
 | 144 | +        }  | 
|---|
| 152 | 145 |           | 
|---|
| 153 | 146 |          if (ray.viewDirection.z == 0) | 
|---|
| 154 | 147 |          { | 
|---|
| .. | .. | 
|---|
| 157 | 150 |          } | 
|---|
| 158 | 151 |          else | 
|---|
| 159 | 152 |          { | 
|---|
| 160 |  | -            if (tmin > mint) tmin = mint;  | 
|---|
| 161 |  | -            if (tmax < maxt) tmax = maxt;  | 
|---|
 | 153 | +            t1 = (min.z - ray.eyePoint.z) / ray.viewDirection.z;  | 
|---|
 | 154 | +            t2 = (max.z - ray.eyePoint.z) / ray.viewDirection.z;  | 
|---|
 | 155 | +  | 
|---|
 | 156 | +            if (t1 > t2)  | 
|---|
 | 157 | +            {  | 
|---|
 | 158 | +                double t = t1;  | 
|---|
 | 159 | +                t1 = t2;  | 
|---|
 | 160 | +                t2 = t;  | 
|---|
 | 161 | +            }  | 
|---|
 | 162 | +  | 
|---|
 | 163 | +            if (tmin > t1) tmin = t1;  | 
|---|
 | 164 | +            if (tmax < t2) tmax = t2;  | 
|---|
| 162 | 165 |          } | 
|---|
| 163 | 166 |           | 
|---|
| 164 |  | -        return tmax > tmin && tmax > 0.0;  | 
|---|
 | 167 | +        return tmax >= tmin && tmax > 0.0;  | 
|---|
| 165 | 168 |      } | 
|---|
| 166 | 169 |  } | 
|---|
 
| .. | .. | 
|---|
| 1 | 1 |   | 
|---|
 | 2 | +import com.bulletphysics.dynamics.RigidBody;  | 
|---|
| 2 | 3 |  import java.awt.*; | 
|---|
| 3 | 4 |  import java.awt.event.*; | 
|---|
| 4 | 5 |  import java.awt.image.*; | 
|---|
| .. | .. | 
|---|
| 14667 | 14668 |          // only one thread!? synchronized | 
|---|
| 14668 | 14669 |                  void StepToTarget(boolean jump) | 
|---|
| 14669 | 14670 |          { | 
|---|
 | 14671 | +            RigidBody.pos.x = (float)manipCamera.lookAt.x;  | 
|---|
 | 14672 | +            RigidBody.pos.y = (float)manipCamera.lookAt.y;  | 
|---|
 | 14673 | +            RigidBody.pos.z = (float)manipCamera.lookAt.z;  | 
|---|
 | 14674 | +//            RigidBody.wind.x = (float)manipCamera.right.x;  | 
|---|
 | 14675 | +//            RigidBody.wind.y = (float)manipCamera.right.y;  | 
|---|
 | 14676 | +//            RigidBody.wind.z = (float)manipCamera.right.z;  | 
|---|
 | 14677 | +            //RigidBody.wind.normalize();  | 
|---|
 | 14678 | +                      | 
|---|
| 14670 | 14679 |              if (mute) | 
|---|
| 14671 | 14680 |                  return; | 
|---|
| 14672 | 14681 |               | 
|---|
 
| .. | .. | 
|---|
| 177 | 177 |   | 
|---|
| 178 | 178 |      public void spawnRagdoll(boolean walk) // random) | 
|---|
| 179 | 179 |      { | 
|---|
| 180 |  | -        RagDoll ragDoll = new RagDoll(null, new Vector3f(0f, 0f, 0f), 0.45f, walk); // Math.random() > 0.5/*true*/); // true);  | 
|---|
 | 180 | +        // KIDS4  | 
|---|
 | 181 | +        RagDoll ragDoll = new RagDoll(null, new Vector3f(0f, 0f, 0f), 0.45f/2, walk); // Math.random() > 0.5/*true*/); // true);  | 
|---|
| 181 | 182 |          ragdolls.add(ragDoll); | 
|---|
| 182 | 183 |           | 
|---|
| 183 | 184 |          bRep = null; | 
|---|
| .. | .. | 
|---|
| 309 | 310 |              walkdefined = true; | 
|---|
| 310 | 311 |          } | 
|---|
| 311 | 312 |           | 
|---|
| 312 |  | -        ragdolls.get(0).init(/*staticdynamicsWorld,*/ new Vector3f(0f, 0f, 0f), 0.45f, walk);  | 
|---|
 | 313 | +        ragdolls.get(0).init(/*staticdynamicsWorld,*/ new Vector3f(0f, 0f, 0f), ragdolls.get(0).scale, walk);  | 
|---|
| 313 | 314 |           | 
|---|
| 314 | 315 |          bRep = null; | 
|---|
| 315 | 316 |      } | 
|---|
 
| .. | .. | 
|---|
| 2515 | 2515 |                      ragdoll.toParent = LA.newMatrix(); | 
|---|
| 2516 | 2516 |                      ragdoll.fromParent = LA.newMatrix(); | 
|---|
| 2517 | 2517 |                       | 
|---|
| 2518 |  | -                    ragdoll.fromParent[1][1] = 1/1.03;  | 
|---|
| 2519 |  | -                    ragdoll.toParent[1][1] = 1.03;  | 
|---|
| 2520 |  | -                      | 
|---|
| 2521 |  | -                    ragdoll.fromParent[3][1] = 0.02;  | 
|---|
| 2522 |  | -                    ragdoll.toParent[3][1] = -0.02;  | 
|---|
| 2523 |  | -                    ragdoll.fromParent[3][2] = 0.01;  | 
|---|
| 2524 |  | -                    ragdoll.toParent[3][2] = -0.01;  | 
|---|
 | 2518 | +//                    ragdoll.fromParent[1][1] = 1/1.03;  | 
|---|
 | 2519 | +//                    ragdoll.toParent[1][1] = 1.03;  | 
|---|
 | 2520 | +//                      | 
|---|
 | 2521 | +//                    ragdoll.fromParent[3][1] = 0.02;  | 
|---|
 | 2522 | +//                    ragdoll.toParent[3][1] = -0.02;  | 
|---|
 | 2523 | +//                    ragdoll.fromParent[3][2] = 0.01;  | 
|---|
 | 2524 | +//                    ragdoll.toParent[3][2] = -0.01;  | 
|---|
| 2525 | 2525 |                       | 
|---|
| 2526 | 2526 |                      makeSomething(ragdoll); | 
|---|
| 2527 | 2527 |  			//makeSomething(new VehicleDemo()); | 
|---|
 
| .. | .. | 
|---|
| 4617 | 4617 |           | 
|---|
| 4618 | 4618 |          ResetModel(); | 
|---|
| 4619 | 4619 |           | 
|---|
| 4620 |  | -        DuplicateVersion();  | 
|---|
 | 4620 | +        //DuplicateVersion();  | 
|---|
| 4621 | 4621 |           | 
|---|
| 4622 | 4622 |          this.SetVersionStates(); | 
|---|
| 4623 | 4623 |          objEditor.refreshContents(); | 
|---|
 
| .. | .. | 
|---|
| 1023 | 1023 |       | 
|---|
| 1024 | 1024 |      void Step() | 
|---|
| 1025 | 1025 |      { | 
|---|
| 1026 |  | -        // marde pour serialization de Texture  | 
|---|
 | 1026 | +        // patch pour serialization de Texture  | 
|---|
| 1027 | 1027 |          resetmaxcount(); | 
|---|
| 1028 | 1028 |          resettransformcount(); | 
|---|
| 1029 | 1029 |          resetstep(); | 
|---|
| .. | .. | 
|---|
| 4101 | 4101 |          Step(); | 
|---|
| 4102 | 4102 |          Touch(); | 
|---|
| 4103 | 4103 |           | 
|---|
| 4104 |  | -        StepRecur();  | 
|---|
| 4105 |  | -    }  | 
|---|
| 4106 |  | -      | 
|---|
| 4107 |  | -    void StepRecur()  | 
|---|
| 4108 |  | -    {  | 
|---|
| 4109 | 4104 |          for (int i = 0; i < size(); i++) | 
|---|
| 4110 | 4105 |          { | 
|---|
| 4111 | 4106 |              Object3D child = (Object3D) get(i); // reserve(i); | 
|---|
| .. | .. | 
|---|
| 6182 | 6177 |          return live && bRep != null; | 
|---|
| 6183 | 6178 |      } | 
|---|
| 6184 | 6179 |       | 
|---|
 | 6180 | +    static cVector minima = new cVector();  | 
|---|
 | 6181 | +    static cVector maxima = new cVector();  | 
|---|
 | 6182 | +    static javax.vecmath.Point3d center = new javax.vecmath.Point3d();  | 
|---|
 | 6183 | +      | 
|---|
| 6185 | 6184 |      void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) | 
|---|
| 6186 | 6185 |      { | 
|---|
| 6187 | 6186 |          Invariants(); // june 2013 | 
|---|
| .. | .. | 
|---|
| 6189 | 6188 |          if (support != null) | 
|---|
| 6190 | 6189 |          { | 
|---|
| 6191 | 6190 |          //    System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); | 
|---|
 | 6191 | +        }  | 
|---|
 | 6192 | +          | 
|---|
 | 6193 | +        if (live && link2master && support == null && !this.marked) // project on ground  | 
|---|
 | 6194 | +        {  | 
|---|
 | 6195 | +            getBounds(minima, maxima, true);  | 
|---|
 | 6196 | +            center.x = (minima.x + maxima.x) / 2;  | 
|---|
 | 6197 | +            center.y = 10000; // (minima.y + maxima.y) / 2;  | 
|---|
 | 6198 | +            center.z = (minima.z + maxima.z) / 2;  | 
|---|
 | 6199 | +  | 
|---|
 | 6200 | +            Ray ray = new Ray(center, new Vector3d(0,-1,0));  | 
|---|
 | 6201 | +  | 
|---|
 | 6202 | +            IntersectResult res = new IntersectResult();  | 
|---|
 | 6203 | +            res.t = Double.POSITIVE_INFINITY;  | 
|---|
 | 6204 | +  | 
|---|
 | 6205 | +            if (Grafreed.grafreed.universe.intersect(ray, res))  | 
|---|
 | 6206 | +            {  | 
|---|
 | 6207 | +                double resx = ray.eyePoint.x + ray.viewDirection.x * res.t;  | 
|---|
 | 6208 | +                double resy = ray.eyePoint.y + ray.viewDirection.y * res.t;  | 
|---|
 | 6209 | +                double resz = ray.eyePoint.z + ray.viewDirection.z * res.t;  | 
|---|
 | 6210 | +                  | 
|---|
 | 6211 | +                LA.matTranslate(toParent, 0, resy - minima.y, 0);  | 
|---|
 | 6212 | +                LA.matInvert(toParent, fromParent);  | 
|---|
 | 6213 | +            }  | 
|---|
| 6192 | 6214 |          } | 
|---|
| 6193 | 6215 |           | 
|---|
| 6194 | 6216 |          if (display.DrawMode() == iCameraPane.SELECTION && | 
|---|
| .. | .. | 
|---|
| 6985 | 7007 |                          facescompare[k] = new FaceCompare(k); | 
|---|
| 6986 | 7008 |                      } | 
|---|
| 6987 | 7009 |                       | 
|---|
| 6988 |  | -                    center = new cVector();  | 
|---|
 | 7010 | +                    centertriangle = new cVector();  | 
|---|
| 6989 | 7011 |                  } | 
|---|
| 6990 | 7012 |                  else | 
|---|
| 6991 | 7013 |                  { | 
|---|
| .. | .. | 
|---|
| 7108 | 7130 |           */ | 
|---|
| 7109 | 7131 |      } | 
|---|
| 7110 | 7132 |   | 
|---|
| 7111 |  | -    transient cVector center;  | 
|---|
 | 7133 | +    transient cVector centertriangle;  | 
|---|
| 7112 | 7134 |       | 
|---|
| 7113 | 7135 |      class FaceCompare implements Comparable | 
|---|
| 7114 | 7136 |      { | 
|---|
| .. | .. | 
|---|
| 7137 | 7159 |                  Vertex q = bRep.GetVertex(face.q); | 
|---|
| 7138 | 7160 |                  Vertex r = bRep.GetVertex(face.r); | 
|---|
| 7139 | 7161 |   | 
|---|
| 7140 |  | -                center.set(p);  | 
|---|
| 7141 |  | -                center.add(q);  | 
|---|
| 7142 |  | -                center.add(r);  | 
|---|
| 7143 |  | -                center.mul(1.0/3);  | 
|---|
 | 7162 | +                centertriangle.set(p);  | 
|---|
 | 7163 | +                centertriangle.add(q);  | 
|---|
 | 7164 | +                centertriangle.add(r);  | 
|---|
 | 7165 | +                centertriangle.mul(1.0/3);  | 
|---|
| 7144 | 7166 |                   | 
|---|
| 7145 |  | -                center.sub(Globals.theRenderer.EyeCamera().location);  | 
|---|
 | 7167 | +                centertriangle.sub(Globals.theRenderer.EyeCamera().location);  | 
|---|
| 7146 | 7168 |                   | 
|---|
| 7147 |  | -                distance = center.dot(center);  | 
|---|
 | 7169 | +                distance = centertriangle.dot(centertriangle);  | 
|---|
| 7148 | 7170 |              } | 
|---|
| 7149 | 7171 |               | 
|---|
| 7150 | 7172 |              return distance; | 
|---|
| .. | .. | 
|---|
| 8903 | 8925 |                  cVector min = new cVector(); | 
|---|
| 8904 | 8926 |                  cVector max = new cVector(); | 
|---|
| 8905 | 8927 |                   | 
|---|
| 8906 |  | -                this.getBounds(min, max, false);  | 
|---|
 | 8928 | +                this.getBounds(min, max, true);  | 
|---|
| 8907 | 8929 |                   | 
|---|
| 8908 | 8930 |                  bbox.min.x = min.x; | 
|---|
| 8909 | 8931 |                  bbox.min.y = min.y; | 
|---|
| .. | .. | 
|---|
| 8914 | 8936 |                  bbox.max.z = max.z; | 
|---|
| 8915 | 8937 |              } | 
|---|
| 8916 | 8938 |               | 
|---|
| 8917 |  | -            if (bbox.intersect(ray, result))  | 
|---|
 | 8939 | +            if (true) // NOT WORKING bbox.intersect(ray, result))  | 
|---|
| 8918 | 8940 |              { | 
|---|
| 8919 | 8941 |                  success |= intersectMesh(ray, result); | 
|---|
| 8920 | 8942 |              } | 
|---|
| .. | .. | 
|---|
| 8958 | 8980 |       | 
|---|
| 8959 | 8981 |      private boolean intersectTriangle(Ray ray, IntersectResult result, Vertex v1, Vertex v2, Vertex v3) | 
|---|
| 8960 | 8982 |      { | 
|---|
 | 8983 | +        if (false)  | 
|---|
 | 8984 | +        {  | 
|---|
 | 8985 | +            result.t = 0;  | 
|---|
 | 8986 | +            return true;  | 
|---|
 | 8987 | +        }  | 
|---|
 | 8988 | +          | 
|---|
| 8961 | 8989 |          /* | 
|---|
| 8962 | 8990 |          Fast, Minimum Storage Ray/Triangle Intersection, Moller et al. | 
|---|
| 8963 | 8991 |           | 
|---|
 
| .. | .. | 
|---|
| 70 | 70 |               */ | 
|---|
| 71 | 71 |              super.SetupUI2(oe); | 
|---|
| 72 | 72 |                   | 
|---|
| 73 |  | -        gravityPanel = AddSlider(oe.ctrlPanel, "Gravity:", 0, 20.0, physicsnode.gravity, 1);  | 
|---|
 | 73 | +        gravityPanel = AddSlider(oe.ctrlPanel, "Gravity:", 0, 100.0, physicsnode.gravity, 1);  | 
|---|
| 74 | 74 |          gravityField = (cNumberSlider)gravityPanel.getComponent(1); | 
|---|
| 75 | 75 |                   | 
|---|
| 76 | 76 |  //        oe.ctrlPanel.add(gravityLabel = new JLabel("Gravity: ")); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2); | 
|---|
| .. | .. | 
|---|
| 79 | 79 |           | 
|---|
| 80 | 80 |          oe.ctrlPanel.Return(); | 
|---|
| 81 | 81 |           | 
|---|
| 82 |  | -        windPanel = AddSlider(oe.ctrlPanel, "Wind:", 0, 20.0, physicsnode.wind, 1);  | 
|---|
 | 82 | +        windPanel = AddSlider(oe.ctrlPanel, "Wind:", 0, 100.0, physicsnode.wind, 1);  | 
|---|
| 83 | 83 |          windField = (cNumberSlider)windPanel.getComponent(1); | 
|---|
| 84 | 84 |           | 
|---|
| 85 | 85 |  //        oe.ctrlPanel.add(windLabel = new JLabel("Wind: ")); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2); | 
|---|
| .. | .. | 
|---|
| 203 | 203 |          physicsnode.floor = (float)floorField.getFloat(); // biparam.minUDivs, 99); | 
|---|
| 204 | 204 |          //biparam.name = nameField.getText(); | 
|---|
| 205 | 205 |           | 
|---|
 | 206 | +        physicsnode.transientDynamicsWorld.setGravity(new javax.vecmath.Vector3f(0, -physicsnode.gravity, physicsnode.wind));  | 
|---|
| 206 | 207 |  // june 2013		super.applySelf(); | 
|---|
| 207 | 208 |      } | 
|---|
| 208 | 209 |      /**/ | 
|---|
 
| .. | .. | 
|---|
| 78 | 78 |          super("Physics"); | 
|---|
| 79 | 79 |           | 
|---|
| 80 | 80 |          live = true; | 
|---|
 | 81 | +          | 
|---|
 | 82 | +        gravity = 1;  | 
|---|
| 81 | 83 |      } | 
|---|
| 82 | 84 |       | 
|---|
| 83 | 85 |      void Reset() | 
|---|
| .. | .. | 
|---|
| 193 | 195 |              //staticdynamicsWorld = dynamicsWorld; | 
|---|
| 194 | 196 |  //		dynamicsWorld.setDebugDrawer(new GLDebugDrawer(gl)); | 
|---|
| 195 | 197 |   | 
|---|
 | 198 | +            float boxsize = 100;  | 
|---|
 | 199 | +              | 
|---|
| 196 | 200 |          // Setup a big ground box | 
|---|
| 197 | 201 |  //        { | 
|---|
| 198 |  | -            CollisionShape groundShape = new BoxShape(new Vector3f(200f, 10f, 200f));  | 
|---|
 | 202 | +            CollisionShape groundShape = new BoxShape(new Vector3f(boxsize, 10f, boxsize));  | 
|---|
| 199 | 203 |              Transform groundTransform = new Transform(); | 
|---|
| 200 | 204 |              groundTransform.setIdentity(); | 
|---|
| 201 | 205 |              groundTransform.origin.set(0f, -floor - 10, 0f); | 
|---|
| 202 | 206 |              localCreateRigidBody(0f, groundTransform, groundShape); | 
|---|
| 203 | 207 |               | 
|---|
| 204 |  | -            groundShape = new BoxShape(new Vector3f(200f, 200f, 200f));  | 
|---|
 | 208 | +            groundShape = new BoxShape(new Vector3f(boxsize, boxsize, boxsize));  | 
|---|
| 205 | 209 |              groundTransform = new Transform(); | 
|---|
| 206 | 210 |              groundTransform.setIdentity(); | 
|---|
| 207 |  | -            groundTransform.origin.set(0f, 100, -201f);  | 
|---|
| 208 |  | -            //localCreateRigidBody(0f, groundTransform, groundShape);  | 
|---|
 | 211 | +            groundTransform.origin.set(0f, boxsize/2, -boxsize-1);  | 
|---|
 | 212 | +            localCreateRigidBody(0f, groundTransform, groundShape);  | 
|---|
| 209 | 213 |               | 
|---|
| 210 |  | -            groundShape = new BoxShape(new Vector3f(200f, 200f, 200f));  | 
|---|
 | 214 | +            groundShape = new BoxShape(new Vector3f(boxsize, boxsize, boxsize));  | 
|---|
| 211 | 215 |              groundTransform = new Transform(); | 
|---|
| 212 | 216 |              groundTransform.setIdentity(); | 
|---|
| 213 |  | -            groundTransform.origin.set(-201f, 100, 0f);  | 
|---|
| 214 |  | -            //localCreateRigidBody(0f, groundTransform, groundShape);  | 
|---|
 | 217 | +            groundTransform.origin.set(-boxsize-1, boxsize/2, 0f);  | 
|---|
 | 218 | +            localCreateRigidBody(0f, groundTransform, groundShape);  | 
|---|
| 215 | 219 |               | 
|---|
| 216 |  | -            groundShape = new BoxShape(new Vector3f(200f, 200f, 200f));  | 
|---|
 | 220 | +            groundShape = new BoxShape(new Vector3f(boxsize, boxsize, boxsize));  | 
|---|
| 217 | 221 |              groundTransform = new Transform(); | 
|---|
| 218 | 222 |              groundTransform.setIdentity(); | 
|---|
| 219 |  | -            groundTransform.origin.set(201f, 100, 0f);  | 
|---|
| 220 |  | -            //localCreateRigidBody(0f, groundTransform, groundShape);  | 
|---|
 | 223 | +            groundTransform.origin.set(boxsize+1, boxsize/2, 0f);  | 
|---|
 | 224 | +            localCreateRigidBody(0f, groundTransform, groundShape);  | 
|---|
| 221 | 225 |               | 
|---|
| 222 |  | -            groundShape = new BoxShape(new Vector3f(200f, 200f, 200f));  | 
|---|
 | 226 | +            groundShape = new BoxShape(new Vector3f(boxsize, boxsize, boxsize));  | 
|---|
| 223 | 227 |              groundTransform = new Transform(); | 
|---|
| 224 | 228 |              groundTransform.setIdentity(); | 
|---|
| 225 |  | -            groundTransform.origin.set(0f, 100, 201f);  | 
|---|
| 226 |  | -            //localCreateRigidBody(0f, groundTransform, groundShape);  | 
|---|
 | 229 | +            groundTransform.origin.set(0f, boxsize/2, boxsize+1);  | 
|---|
 | 230 | +            localCreateRigidBody(0f, groundTransform, groundShape);  | 
|---|
| 227 | 231 |               | 
|---|
| 228 |  | -            transientDynamicsWorld.setGravity(new Vector3f(0, -gravity, wind));  | 
|---|
 | 232 | +            transientDynamicsWorld.setGravity(new Vector3f(0.075f, -gravity, wind));  | 
|---|
| 229 | 233 |               | 
|---|
| 230 | 234 |              SetDynamics(transientDynamicsWorld); | 
|---|
| 231 | 235 |          } | 
|---|
| .. | .. | 
|---|
| 251 | 255 |  //        myoffset = dynamicsWorld.getNumCollisionObjects() - 1; | 
|---|
| 252 | 256 |  //         | 
|---|
| 253 | 257 |  //        if (myoffset == 0) | 
|---|
| 254 |  | -            clientResetScene();  | 
|---|
 | 258 | +//            clientResetScene();  | 
|---|
| 255 | 259 |      } | 
|---|
| 256 | 260 |   | 
|---|
| 257 | 261 |      public RigidBody localCreateRigidBody(float mass, Transform startTransform, CollisionShape shape) | 
|---|
| .. | .. | 
|---|
| 271 | 275 |          //#ifdef USE_MOTIONSTATE | 
|---|
| 272 | 276 |          DefaultMotionState myMotionState = new DefaultMotionState(startTransform); | 
|---|
| 273 | 277 |   | 
|---|
| 274 |  | -        float friction = 1;  | 
|---|
 | 278 | +        float friction = 1f;  | 
|---|
| 275 | 279 |           | 
|---|
| 276 | 280 |          RigidBodyConstructionInfo cInfo = new RigidBodyConstructionInfo(mass, myMotionState, shape, localInertia, friction); | 
|---|
| 277 | 281 |   | 
|---|
| .. | .. | 
|---|
| 288 | 292 |   | 
|---|
| 289 | 293 |      public void clientResetScene() | 
|---|
| 290 | 294 |      { | 
|---|
| 291 |  | -//        System.exit(0);  | 
|---|
 | 295 | +        System.exit(0);  | 
|---|
| 292 | 296 |          //#ifdef SHOW_NUM_DEEP_PENETRATIONS | 
|---|
| 293 | 297 |          BulletStats.gNumDeepPenetrationChecks = 0; | 
|---|
| 294 | 298 |          BulletStats.gNumGjkChecks = 0; | 
|---|
 
| .. | .. | 
|---|
| 123 | 123 |  		JOINT_COUNT | 
|---|
| 124 | 124 |  	} | 
|---|
| 125 | 125 |   | 
|---|
 | 126 | +        float scale;  | 
|---|
 | 127 | +          | 
|---|
| 126 | 128 |  	//DynamicsWorld ownerWorld; | 
|---|
| 127 | 129 |  	CollisionShape[] shapes = new CollisionShape[BodyPart.BODYPART_COUNT.ordinal()]; | 
|---|
| 128 | 130 |  	RigidBody/*Serial*/[] bodies = new RigidBody/*Serial*/[BodyPart.BODYPART_COUNT.ordinal()]; | 
|---|
| .. | .. | 
|---|
| 140 | 142 |           | 
|---|
| 141 | 143 |  	public void init(/*DynamicsWorld ownerWorld,*/ Vector3f positionOffset, float scale_ragdoll, boolean walk) | 
|---|
| 142 | 144 |          { | 
|---|
 | 145 | +            scale = scale_ragdoll;  | 
|---|
 | 146 | +              | 
|---|
| 143 | 147 |                  this.walkmotion = walk; | 
|---|
| 144 | 148 |                   | 
|---|
| 145 | 149 |                  boolean hasbodies = (bodies[BodyPart.BODYPART_SPINE.ordinal()] != null); | 
|---|
| .. | .. | 
|---|
| 149 | 153 |  		Transform tmpTrans = new Transform(); | 
|---|
| 150 | 154 |  		Vector3f tmp = new Vector3f(); | 
|---|
| 151 | 155 |   | 
|---|
| 152 |  | -                boolean node = true;  | 
|---|
 | 156 | +                boolean node = false; // true;  | 
|---|
 | 157 | +                  | 
|---|
 | 158 | +                // KIDS4  | 
|---|
 | 159 | +                float upperarmlength = 0.3f; // 0.25  | 
|---|
 | 160 | +                float lowerarmlength = 0.25f; // 0.2  | 
|---|
 | 161 | +                float handlength = 0.1f; // 0.1  | 
|---|
 | 162 | +                float upperarmdist = 0.15f;  | 
|---|
| 153 | 163 |                   | 
|---|
| 154 | 164 |  		// Setup the geometry | 
|---|
| 155 | 165 |  		//shapes[BodyPart.BODYPART_GROUND.ordinal()] = new CapsuleShape(scale_ragdoll * 0.125f, scale_ragdoll * 0.20f); | 
|---|
| 156 | 166 |                  //scale_ragdoll /= 1.25; | 
|---|
| 157 | 167 |                  if (!hasbodies) | 
|---|
| 158 | 168 |                  { | 
|---|
| 159 |  | -                    shapes[BodyPart.BODYPART_PELVIS.ordinal()] = new CapsuleShape(scale_ragdoll * 0.15f, scale_ragdoll * 0.35f,false);  | 
|---|
| 160 |  | -                    shapes[BodyPart.BODYPART_SPINE.ordinal()] = new CapsuleShape(scale_ragdoll * 0.2f, scale_ragdoll * 0.5f,false);  | 
|---|
| 161 |  | -                    shapes[BodyPart.BODYPART_HEAD.ordinal()] = new CapsuleShape(scale_ragdoll * 0.15f, scale_ragdoll * 0.15f,false);  | 
|---|
 | 169 | +                    float thin = 0.1f;  | 
|---|
 | 170 | +                      | 
|---|
 | 171 | +                    shapes[BodyPart.BODYPART_PELVIS.ordinal()] = new CapsuleShape(scale_ragdoll * 0.15f, scale_ragdoll * 0.35f, false);  | 
|---|
 | 172 | +                    shapes[BodyPart.BODYPART_SPINE.ordinal()] = new CapsuleShape(scale_ragdoll * 0.2f, scale_ragdoll * 0.5f, false);  | 
|---|
 | 173 | +                    shapes[BodyPart.BODYPART_HEAD.ordinal()] = new CapsuleShape(scale_ragdoll * 0.15f, scale_ragdoll * 0.15f, false);  | 
|---|
| 162 | 174 |   | 
|---|
| 163 |  | -                    shapes[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()] = new CapsuleShape(scale_ragdoll * 0.1f, scale_ragdoll * 0.4f,false);  | 
|---|
| 164 |  | -                    shapes[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()] = new CapsuleShape(scale_ragdoll * 0.06f, scale_ragdoll * 0.37f,node);  | 
|---|
| 165 |  | -                    shapes[BodyPart.BODYPART_LEFT_FOOT.ordinal()] = new CapsuleShape(scale_ragdoll * 0.04f, scale_ragdoll * 0.1f,node);  | 
|---|
 | 175 | +                    shapes[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()] = new CapsuleShape(scale_ragdoll * 0.4f * thin, scale_ragdoll * 0.4f, node);  | 
|---|
 | 176 | +                    shapes[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()] = new CapsuleShape(scale_ragdoll * 0.37f * thin, scale_ragdoll * 0.37f, node);  | 
|---|
 | 177 | +                    shapes[BodyPart.BODYPART_LEFT_FOOT.ordinal()] = new CapsuleShape(scale_ragdoll * 0.1f * thin, scale_ragdoll * 0.1f, node);  | 
|---|
| 166 | 178 |   | 
|---|
| 167 |  | -                    shapes[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()] = new CapsuleShape(scale_ragdoll * 0.1f, scale_ragdoll * 0.4f,false);  | 
|---|
| 168 |  | -                    shapes[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()] = new CapsuleShape(scale_ragdoll * 0.06f, scale_ragdoll * 0.37f,node);  | 
|---|
| 169 |  | -                    shapes[BodyPart.BODYPART_RIGHT_FOOT.ordinal()] = new CapsuleShape(scale_ragdoll * 0.04f, scale_ragdoll * 0.1f,node);  | 
|---|
 | 179 | +                    shapes[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()] = new CapsuleShape(scale_ragdoll * 0.4f * thin, scale_ragdoll * 0.4f, node);  | 
|---|
 | 180 | +                    shapes[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()] = new CapsuleShape(scale_ragdoll * 0.37f * thin, scale_ragdoll * 0.37f, node);  | 
|---|
 | 181 | +                    shapes[BodyPart.BODYPART_RIGHT_FOOT.ordinal()] = new CapsuleShape(scale_ragdoll * 0.1f * thin, scale_ragdoll * 0.1f, node);  | 
|---|
| 170 | 182 |   | 
|---|
| 171 |  | -                    shapes[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()] = new CapsuleShape(scale_ragdoll * 0.08f, scale_ragdoll * 0.25f,node);  | 
|---|
| 172 |  | -                    shapes[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()] = new CapsuleShape(scale_ragdoll * 0.06f, scale_ragdoll * 0.2f,node);  | 
|---|
| 173 |  | -                    shapes[BodyPart.BODYPART_LEFT_HAND.ordinal()] = new CapsuleShape(scale_ragdoll * 0.04f, scale_ragdoll * 0.1f,node);  | 
|---|
 | 183 | +                    shapes[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()] = new CapsuleShape(scale_ragdoll * upperarmlength * thin, scale_ragdoll * upperarmlength, node);  | 
|---|
 | 184 | +                    shapes[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()] = new CapsuleShape(scale_ragdoll * lowerarmlength * thin, scale_ragdoll * lowerarmlength, node);  | 
|---|
 | 185 | +                    shapes[BodyPart.BODYPART_LEFT_HAND.ordinal()] = new CapsuleShape(scale_ragdoll * handlength * thin, scale_ragdoll * handlength, node);  | 
|---|
| 174 | 186 |   | 
|---|
| 175 |  | -                    shapes[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()] = new CapsuleShape(scale_ragdoll * 0.08f, scale_ragdoll * 0.25f,node);  | 
|---|
| 176 |  | -                    shapes[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()] = new CapsuleShape(scale_ragdoll * 0.06f, scale_ragdoll * 0.2f,node);  | 
|---|
| 177 |  | -                    shapes[BodyPart.BODYPART_RIGHT_HAND.ordinal()] = new CapsuleShape(scale_ragdoll * 0.04f, scale_ragdoll * 0.1f,node);  | 
|---|
 | 187 | +                    shapes[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()] = new CapsuleShape(scale_ragdoll * upperarmlength * thin, scale_ragdoll * upperarmlength, node);  | 
|---|
 | 188 | +                    shapes[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()] = new CapsuleShape(scale_ragdoll * lowerarmlength * thin, scale_ragdoll * lowerarmlength, node);  | 
|---|
 | 189 | +                    shapes[BodyPart.BODYPART_RIGHT_HAND.ordinal()] = new CapsuleShape(scale_ragdoll * handlength * thin, scale_ragdoll * handlength, node);  | 
|---|
| 178 | 190 |                  } | 
|---|
| 179 | 191 |                  //scale_ragdoll *= 1.25; | 
|---|
| 180 | 192 |   | 
|---|
| .. | .. | 
|---|
| 185 | 197 |   | 
|---|
| 186 | 198 |  		Transform transform = new Transform(); | 
|---|
| 187 | 199 |                   | 
|---|
| 188 |  | -                float depth = -0.02f; // .02f;  | 
|---|
 | 200 | +                float depth = -0.01f; // .02f;  | 
|---|
| 189 | 201 |                   | 
|---|
| 190 | 202 |  //		transform.setIdentity(); | 
|---|
| 191 | 203 |  //		transform.origin.set(0f, scale_ragdoll * 1f, 0f); | 
|---|
| .. | .. | 
|---|
| 242 | 254 |  		transform.setIdentity(); | 
|---|
| 243 | 255 |  		if ((body = bodies[BodyPart.BODYPART_LEFT_FOOT.ordinal()]) == null) | 
|---|
| 244 | 256 |                      body = bodies[BodyPart.BODYPART_LEFT_FOOT.ordinal()] = localCreateRigidBody(massfeet, poisefeet, transform, shapes[BodyPart.BODYPART_LEFT_FOOT.ordinal()]); | 
|---|
| 245 |  | -		transform.origin.set(-0.09f * scale_ragdoll, 0.075f * scale_ragdoll, 0.025f);  | 
|---|
 | 257 | +		transform.origin.set(-0.09f * scale_ragdoll, 0.075f * scale_ragdoll, 0.0125f);  | 
|---|
| 246 | 258 |  		MatrixUtil.setEulerZYX(transform.basis, BulletGlobals.SIMD_PI/2, 0,BulletGlobals.SIMD_PI); // BulletGlobals.SIMD_PI, 0); | 
|---|
| 247 | 259 |  		tmpTrans.mul(offset, transform); | 
|---|
| 248 | 260 |  		body.worldTransform.set(tmpTrans); | 
|---|
| .. | .. | 
|---|
| 252 | 264 |  		transform.setIdentity(); | 
|---|
| 253 | 265 |  		if ((body = bodies[BodyPart.BODYPART_RIGHT_FOOT.ordinal()]) == null) | 
|---|
| 254 | 266 |                      body = bodies[BodyPart.BODYPART_RIGHT_FOOT.ordinal()] = localCreateRigidBody(massfeet, poisefeet, transform, shapes[BodyPart.BODYPART_RIGHT_FOOT.ordinal()]); | 
|---|
| 255 |  | -		transform.origin.set(0.09f * scale_ragdoll, 0.075f * scale_ragdoll, 0.025f);  | 
|---|
 | 267 | +		transform.origin.set(0.09f * scale_ragdoll, 0.075f * scale_ragdoll, 0.0125f);  | 
|---|
| 256 | 268 |  		MatrixUtil.setEulerZYX(transform.basis, BulletGlobals.SIMD_PI/2, 0,BulletGlobals.SIMD_PI); // BulletGlobals.SIMD_PI, 0); | 
|---|
| 257 | 269 |  		tmpTrans.mul(offset, transform); | 
|---|
| 258 | 270 |  		body.worldTransform.set(tmpTrans); | 
|---|
| .. | .. | 
|---|
| 300 | 312 |  		transform.setIdentity(); | 
|---|
| 301 | 313 |  		if ((body = bodies[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()]) == null) | 
|---|
| 302 | 314 |                      body = bodies[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()] = localCreateRigidBody(1f, 0, transform, shapes[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()]); | 
|---|
| 303 |  | -		transform.origin.set(-0.275f * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
 | 315 | +		transform.origin.set(-(upperarmlength/2 + upperarmdist) * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
| 304 | 316 |  		MatrixUtil.setEulerZYX(transform.basis, 0, 0, BulletGlobals.SIMD_HALF_PI); | 
|---|
| 305 | 317 |  		tmpTrans.mul(offset, transform); | 
|---|
| 306 | 318 |  		body.worldTransform.set(tmpTrans); | 
|---|
| .. | .. | 
|---|
| 310 | 322 |  		transform.setIdentity(); | 
|---|
| 311 | 323 |  		if ((body = bodies[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()]) == null) | 
|---|
| 312 | 324 |                      body = bodies[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()] = localCreateRigidBody(1f, 0, transform, shapes[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()]); | 
|---|
| 313 |  | -		transform.origin.set(-0.5f * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
 | 325 | +		transform.origin.set(-(lowerarmlength/2 + upperarmlength + upperarmdist) * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
| 314 | 326 |  		MatrixUtil.setEulerZYX(transform.basis, 0, 0, BulletGlobals.SIMD_HALF_PI); | 
|---|
| 315 | 327 |  		tmpTrans.mul(offset, transform); | 
|---|
| 316 | 328 |  		body.worldTransform.set(tmpTrans); | 
|---|
| .. | .. | 
|---|
| 320 | 332 |  		transform.setIdentity(); | 
|---|
| 321 | 333 |  		if ((body = bodies[BodyPart.BODYPART_LEFT_HAND.ordinal()]) == null) | 
|---|
| 322 | 334 |                      body = bodies[BodyPart.BODYPART_LEFT_HAND.ordinal()] = localCreateRigidBody(1f, 0, transform, shapes[BodyPart.BODYPART_LEFT_HAND.ordinal()]); | 
|---|
| 323 |  | -		transform.origin.set(-0.65f * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
 | 335 | +		transform.origin.set(-(handlength/2 + lowerarmlength + upperarmlength + upperarmdist) * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
| 324 | 336 |  		MatrixUtil.setEulerZYX(transform.basis, 0, 0, BulletGlobals.SIMD_HALF_PI); | 
|---|
| 325 | 337 |  		tmpTrans.mul(offset, transform); | 
|---|
| 326 | 338 |  		body.worldTransform.set(tmpTrans); | 
|---|
| .. | .. | 
|---|
| 330 | 342 |  		transform.setIdentity(); | 
|---|
| 331 | 343 |  		if ((body = bodies[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()]) == null) | 
|---|
| 332 | 344 |                      body = bodies[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()] = localCreateRigidBody(1f, 0, transform, shapes[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()]); | 
|---|
| 333 |  | -		transform.origin.set(0.275f * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
 | 345 | +		transform.origin.set((upperarmlength/2 + upperarmdist) * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
| 334 | 346 |  		MatrixUtil.setEulerZYX(transform.basis, 0, 0, -BulletGlobals.SIMD_HALF_PI); | 
|---|
| 335 | 347 |  		tmpTrans.mul(offset, transform); | 
|---|
| 336 | 348 |  		body.worldTransform.set(tmpTrans); | 
|---|
| .. | .. | 
|---|
| 340 | 352 |  		transform.setIdentity(); | 
|---|
| 341 | 353 |  		if ((body = bodies[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()]) == null) | 
|---|
| 342 | 354 |                      body = bodies[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()] = localCreateRigidBody(1f, 0, transform, shapes[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()]); | 
|---|
| 343 |  | -		transform.origin.set(0.50f * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
 | 355 | +		transform.origin.set((lowerarmlength/2 + upperarmlength + upperarmdist) * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
| 344 | 356 |  		MatrixUtil.setEulerZYX(transform.basis, 0, 0, -BulletGlobals.SIMD_HALF_PI); | 
|---|
| 345 | 357 |  		tmpTrans.mul(offset, transform); | 
|---|
| 346 | 358 |  		body.worldTransform.set(tmpTrans); | 
|---|
| .. | .. | 
|---|
| 350 | 362 |  		transform.setIdentity(); | 
|---|
| 351 | 363 |  		if ((body = bodies[BodyPart.BODYPART_RIGHT_HAND.ordinal()]) == null) | 
|---|
| 352 | 364 |                      body = bodies[BodyPart.BODYPART_RIGHT_HAND.ordinal()] = localCreateRigidBody(1f, 0, transform, shapes[BodyPart.BODYPART_RIGHT_HAND.ordinal()]); | 
|---|
| 353 |  | -		transform.origin.set(0.65f * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
 | 365 | +		transform.origin.set((handlength/2 + lowerarmlength + upperarmlength + upperarmdist) * scale_ragdoll, 1.325f * scale_ragdoll, depth);  | 
|---|
| 354 | 366 |  		MatrixUtil.setEulerZYX(transform.basis, 0, 0, -BulletGlobals.SIMD_HALF_PI); | 
|---|
| 355 | 367 |  		tmpTrans.mul(offset, transform); | 
|---|
| 356 | 368 |  		body.worldTransform.set(tmpTrans); | 
|---|
| .. | .. | 
|---|
| 418 | 430 |  			localA.setIdentity(); | 
|---|
| 419 | 431 |  			localB.setIdentity(); | 
|---|
| 420 | 432 |   | 
|---|
| 421 |  | -			localA.origin.set(-0.15f * scale_ragdoll, 0.125f * scale_ragdoll, depth);  | 
|---|
 | 433 | +			localA.origin.set(-upperarmdist * scale_ragdoll, 0.125f * scale_ragdoll, depth);  | 
|---|
| 422 | 434 |   | 
|---|
| 423 | 435 |  			MatrixUtil.setEulerZYX(localB.basis, 0/*BulletGlobals.SIMD_HALF_PI*/, 0, -BulletGlobals.SIMD_HALF_PI); | 
|---|
| 424 |  | -			localB.origin.set(0f, -0.125f * scale_ragdoll, 0);  | 
|---|
 | 436 | +			localB.origin.set(0f, -upperarmlength/2 * scale_ragdoll, 0);  | 
|---|
| 425 | 437 |   | 
|---|
| 426 | 438 |  			joint6DOF = new Generic6DofConstraint(bodies[BodyPart.BODYPART_SPINE.ordinal()], bodies[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()], localA, localB, useLinearReferenceFrameA); | 
|---|
| 427 | 439 |   | 
|---|
| .. | .. | 
|---|
| 447 | 459 |  			localA.setIdentity(); | 
|---|
| 448 | 460 |  			localB.setIdentity(); | 
|---|
| 449 | 461 |   | 
|---|
| 450 |  | -			localA.origin.set(0.15f * scale_ragdoll, 0.125f * scale_ragdoll, depth);  | 
|---|
 | 462 | +			localA.origin.set(upperarmdist * scale_ragdoll, 0.125f * scale_ragdoll, depth);  | 
|---|
| 451 | 463 |  			MatrixUtil.setEulerZYX(localB.basis, 0, 0, BulletGlobals.SIMD_HALF_PI); | 
|---|
| 452 |  | -			localB.origin.set(0f, -0.125f * scale_ragdoll, 0);  | 
|---|
 | 464 | +			localB.origin.set(0f, -upperarmlength/2 * scale_ragdoll, 0);  | 
|---|
| 453 | 465 |  			joint6DOF = new Generic6DofConstraint(bodies[BodyPart.BODYPART_SPINE.ordinal()], bodies[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()], localA, localB, useLinearReferenceFrameA); | 
|---|
| 454 | 466 |   | 
|---|
| 455 | 467 |  			//#ifdef RIGID | 
|---|
| .. | .. | 
|---|
| 474 | 486 |  			localA.setIdentity(); | 
|---|
| 475 | 487 |  			localB.setIdentity(); | 
|---|
| 476 | 488 |   | 
|---|
| 477 |  | -			localA.origin.set(0f, 0.125f * scale_ragdoll, 0f);  | 
|---|
| 478 |  | -			localB.origin.set(0f, -0.1f * scale_ragdoll, 0f);  | 
|---|
 | 489 | +			localA.origin.set(0f, upperarmlength/2 * scale_ragdoll, 0f);  | 
|---|
 | 490 | +			localB.origin.set(0f, -lowerarmlength/2 * scale_ragdoll, 0f);  | 
|---|
| 479 | 491 |  			joint6DOF = new Generic6DofConstraint(bodies[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()], bodies[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()], localA, localB, useLinearReferenceFrameA); | 
|---|
| 480 | 492 |   | 
|---|
| 481 | 493 |  			//#ifdef RIGID | 
|---|
| .. | .. | 
|---|
| 500 | 512 |  			localA.setIdentity(); | 
|---|
| 501 | 513 |  			localB.setIdentity(); | 
|---|
| 502 | 514 |   | 
|---|
| 503 |  | -			localA.origin.set(0f, 0.125f * scale_ragdoll, 0f);  | 
|---|
| 504 |  | -			localB.origin.set(0f, -0.1f * scale_ragdoll, 0f);  | 
|---|
 | 515 | +			localA.origin.set(0f, upperarmlength/2 * scale_ragdoll, 0f);  | 
|---|
 | 516 | +			localB.origin.set(0f, -lowerarmlength/2 * scale_ragdoll, 0f);  | 
|---|
| 505 | 517 |  			joint6DOF = new Generic6DofConstraint(bodies[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()], bodies[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()], localA, localB, useLinearReferenceFrameA); | 
|---|
| 506 | 518 |   | 
|---|
| 507 | 519 |  			//#ifdef RIGID | 
|---|
| .. | .. | 
|---|
| 526 | 538 |  			localA.setIdentity(); | 
|---|
| 527 | 539 |  			localB.setIdentity(); | 
|---|
| 528 | 540 |   | 
|---|
| 529 |  | -			localA.origin.set(0f, 0.1f * scale_ragdoll, 0f);  | 
|---|
| 530 |  | -			localB.origin.set(0f, -0.05f * scale_ragdoll, 0f);  | 
|---|
 | 541 | +			localA.origin.set(0f, lowerarmlength/2 * scale_ragdoll, 0f);  | 
|---|
 | 542 | +			localB.origin.set(0f, -handlength/2 * scale_ragdoll, 0f);  | 
|---|
| 531 | 543 |  			joint6DOF = new Generic6DofConstraint(bodies[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()], bodies[BodyPart.BODYPART_LEFT_HAND.ordinal()], localA, localB, useLinearReferenceFrameA); | 
|---|
| 532 | 544 |   | 
|---|
| 533 | 545 |  			//#ifdef RIGID | 
|---|
| .. | .. | 
|---|
| 552 | 564 |  			localA.setIdentity(); | 
|---|
| 553 | 565 |  			localB.setIdentity(); | 
|---|
| 554 | 566 |   | 
|---|
| 555 |  | -			localA.origin.set(0f, 0.1f * scale_ragdoll, 0f);  | 
|---|
| 556 |  | -			localB.origin.set(0f, -0.05f * scale_ragdoll, 0f);  | 
|---|
 | 567 | +			localA.origin.set(0f, lowerarmlength/2 * scale_ragdoll, 0f);  | 
|---|
 | 568 | +			localB.origin.set(0f, -handlength/2 * scale_ragdoll, 0f);  | 
|---|
| 557 | 569 |  			joint6DOF = new Generic6DofConstraint(bodies[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()], bodies[BodyPart.BODYPART_RIGHT_HAND.ordinal()], localA, localB, useLinearReferenceFrameA); | 
|---|
| 558 | 570 |   | 
|---|
| 559 | 571 |  			//#ifdef RIGID | 
|---|
 
| .. | .. | 
|---|
| 118 | 118 |                          if (loop == 1) | 
|---|
| 119 | 119 |                          { | 
|---|
| 120 | 120 |                              //vec2.scale(0.5f); | 
|---|
 | 121 | +                              | 
|---|
 | 122 | +                            // Nodes are bigger  | 
|---|
 | 123 | +                            vec2.x *= 5;  | 
|---|
 | 124 | +                            vec2.y *= 5;  | 
|---|
 | 125 | +                            vec2.z *= 5;  | 
|---|
 | 126 | +                              | 
|---|
| 121 | 127 |                              switch (capsule.getUpAxis()) | 
|---|
| 122 | 128 |                              { | 
|---|
| 123 | 129 |                                  case 0: vec2.x /= capsule.getHalfHeight(); vec2.x *= capsule.getRadius()/2; vec2.x -= capsule.getHalfHeight(); break; | 
|---|
| .. | .. | 
|---|
| 125 | 131 |                                  case 2: vec2.z /= capsule.getHalfHeight(); vec2.z *= capsule.getRadius()/2; vec2.z -= capsule.getHalfHeight(); break; | 
|---|
| 126 | 132 |                              } | 
|---|
| 127 | 133 |                          } | 
|---|
 | 134 | +                          | 
|---|
| 128 | 135 |                          vertices.getQuick(loop*NUM_UNITSPHERE_POINTS + i*rows + j).set(vec2); | 
|---|
| 129 | 136 |                          normals.getQuick(loop*NUM_UNITSPHERE_POINTS + i*rows + j).set(normout); | 
|---|
| 130 | 137 |                      } | 
|---|
 
| .. | .. | 
|---|
| 214 | 214 |  		} | 
|---|
| 215 | 215 |  	} | 
|---|
| 216 | 216 |  	 | 
|---|
 | 217 | +        static Vector3f g = new Vector3f();  | 
|---|
 | 218 | +        static Vector3f w = new Vector3f();  | 
|---|
 | 219 | +        static public Vector3f wind = new Vector3f();  | 
|---|
 | 220 | +        static public Vector3f pos = new Vector3f();  | 
|---|
 | 221 | +          | 
|---|
| 217 | 222 |  	public void applyGravity() { | 
|---|
| 218 | 223 |  		if (isStaticOrKinematicObject()) | 
|---|
| 219 | 224 |  			return; | 
|---|
| 220 | 225 |   | 
|---|
| 221 |  | -		applyCentralForce(gravity);  | 
|---|
 | 226 | +                g.y = gravity.y;  | 
|---|
 | 227 | +		applyCentralForce(g);  | 
|---|
 | 228 | +                  | 
|---|
 | 229 | +                wind.set(pos);  | 
|---|
 | 230 | +                wind.x -= worldTransform.origin.x;  | 
|---|
 | 231 | +                wind.y -= worldTransform.origin.y;  | 
|---|
 | 232 | +                wind.z -= worldTransform.origin.z;  | 
|---|
 | 233 | +                  | 
|---|
 | 234 | +                float dot = pos.x * wind.x + pos.y * wind.y + pos.z * wind.z;  | 
|---|
 | 235 | +                  | 
|---|
 | 236 | +                dot = 10;  | 
|---|
 | 237 | +                  | 
|---|
 | 238 | +                w.x = wind.x * gravity.z * dot;  | 
|---|
 | 239 | +                w.y = wind.y * gravity.z * dot;  | 
|---|
 | 240 | +                w.z = wind.z * gravity.z * dot;  | 
|---|
 | 241 | +		applyCentralForce(w);  | 
|---|
| 222 | 242 |  	} | 
|---|
| 223 | 243 |  	 | 
|---|
| 224 | 244 |  	public void setGravity(Vector3f acceleration) { | 
|---|