Normand Briere
2019-09-25 51e45bf615e1e2b4aca2edf9f7333b687c7d015e
Remove hands.
8 files modified
149 ■■■■■ changed files
CameraPane.java 48 ●●●●● patch | view | raw | blame | history
GenericJoint.java 2 ●●● patch | view | raw | blame | history
Merge.java 2 ●●● patch | view | raw | blame | history
Object3D.java 2 ●●● patch | view | raw | blame | history
PhysicsEditor.java 4 ●●●● patch | view | raw | blame | history
PhysicsNode.java 2 ●●● patch | view | raw | blame | history
RagDoll.java 60 ●●●●● patch | view | raw | blame | history
com/bulletphysics/dynamics/RigidBody.java 29 ●●●● patch | view | raw | blame | history
CameraPane.java
....@@ -6962,30 +6962,30 @@
69626962 short residu = 0;
69636963
69646964 // wraparound workarounds
6965
- short fuck = (short) (buffer[i] & 0xFF);
6965
+ short ww = (short) (buffer[i] & 0xFF);
69666966 /*
6967
- residu += (fuck%2);
6968
- if(fuck/2 < 256-residu/2)
6967
+ residu += (ww%2);
6968
+ if(ww/2 < 256-residu/2)
69696969 {
6970
- fuck = (short)((fuck/2) + residu/2);
6970
+ ww = (short)((ww/2) + residu/2);
69716971 if(residu == 2)
69726972 residu = 0;
69736973 }
69746974 else
69756975 {
69766976 residu = 0;
6977
- fuck /= 2;
6977
+ ww /= 2;
69786978 }
69796979 */
6980
- if (i < imglength / 3 || rnd.nextFloat() < 0.5 || fuck >= 254)
6980
+ if (i < imglength / 3 || rnd.nextFloat() < 0.5 || ww >= 254)
69816981 {
6982
- fuck /= 2;
6982
+ ww /= 2;
69836983 } else
69846984 {
6985
- fuck = (short) ((fuck / 2) + fuck % 2);
6985
+ ww = (short) ((ww / 2) + ww % 2);
69866986 }
69876987
6988
- buffer[i] = (byte) fuck;
6988
+ buffer[i] = (byte) ww;
69896989 }
69906990 //System.out.print(bytes[i] + " ");
69916991 //if(buffer[i] >= 0 && buffer[i]<=eps-1) buffer[i] = eps;
....@@ -14341,10 +14341,13 @@
1434114341 public void mouseClicked(MouseEvent e)
1434214342 {
1434314343 System.out.println("mouseClicked: " + e);
14344
+ System.exit(0);
1434414345 }
1434514346
1434614347 public void mousePressed(MouseEvent e)
1434714348 {
14349
+ RigidBody.justclicked = true;
14350
+ System.out.println("justclicked: " + e);
1434814351 //System.out.println("mousePressed: " + e);
1434914352 clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1435014353 }
....@@ -14668,13 +14671,20 @@
1466814671 // only one thread!? synchronized
1466914672 void StepToTarget(boolean jump)
1467014673 {
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();
14674
+ RigidBody.pos.x = 0;
14675
+ RigidBody.pos.y = 0;
14676
+ RigidBody.pos.z = 0;
14677
+ if (RigidBody.justclicked)
14678
+ {
14679
+ RigidBody.pos.x = (float)manipCamera.lookAt.x;
14680
+ RigidBody.pos.y = (float)manipCamera.lookAt.y;
14681
+ RigidBody.pos.z = (float)manipCamera.lookAt.z;
14682
+ RigidBody.wind.set(RigidBody.pos);
14683
+ RigidBody.wind.x -= (float)manipCamera.location.x;
14684
+ RigidBody.wind.y -= (float)manipCamera.location.y;
14685
+ RigidBody.wind.z -= (float)manipCamera.location.z;
14686
+ RigidBody.wind.normalize();
14687
+ }
1467814688
1467914689 if (mute)
1468014690 return;
....@@ -15022,6 +15032,8 @@
1502215032
1502315033 void GoUp(int mod)
1502415034 {
15035
+ RigidBody.justclicked = true;
15036
+
1502515037 MODIFIERS |= COMMAND;
1502615038 /**/
1502715039 boolean isVR = (mouseMode&VR)!=0;
....@@ -16752,7 +16764,8 @@
1675216764
1675316765 public boolean mouseDrag(Event evt, int x, int y)
1675416766 {
16755
- //System.out.println("mouseDrag: " + evt);
16767
+ System.out.println("mouseDrag: " + evt);
16768
+ System.exit(0);
1675616769 /*
1675716770 drag = true;
1675816771 //System.out.println("Mouse DRAG");
....@@ -16871,6 +16884,7 @@
1687116884 public boolean mouseUp(Event evt, int x, int y)
1687216885 {
1687316886 System.out.println("mouseUp: " + evt);
16887
+ System.exit(0);
1687416888 /*
1687516889 locked = false;
1687616890 if (isRenderer)
GenericJoint.java
....@@ -342,7 +342,7 @@
342342
343343 // assert(bRep != null);
344344
345
- if (Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // FUCK
345
+ if (Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // SHADOW
346346 {
347347 // float ms = getDeltaTimeMicroseconds();
348348 // float minFPS = 1000000f / 60f;
Merge.java
....@@ -144,7 +144,7 @@
144144 if (bRep == null && GetObject() != null)
145145 renderme(); // display); // only once
146146
147
- if (/*display.LIVE && live &&*/link2master) // && display.drawMode == display.SHADOW) // FUCK!!!
147
+ if (/*display.LIVE && live &&*/link2master) // && display.drawMode == display.SHADOW) // SHADOW!!!
148148 {
149149 try
150150 {
Object3D.java
....@@ -8349,7 +8349,7 @@
83498349
83508350 public int hashCode()
83518351 {
8352
- // Fuck Vector...
8352
+ // Do not use Vector...
83538353 return System.identityHashCode(this);
83548354 }
83558355
PhysicsEditor.java
....@@ -70,7 +70,7 @@
7070 */
7171 super.SetupUI2(oe);
7272
73
- gravityPanel = AddSlider(oe.ctrlPanel, "Gravity:", 0, 100.0, physicsnode.gravity, 1);
73
+ gravityPanel = AddSlider(oe.ctrlPanel, "Gravity:", 0, 10.0, physicsnode.gravity, 1);
7474 gravityField = (cNumberSlider)gravityPanel.getComponent(1);
7575
7676 // oe.ctrlPanel.add(gravityLabel = new JLabel("Gravity: ")); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
....@@ -79,7 +79,7 @@
7979
8080 oe.ctrlPanel.Return();
8181
82
- windPanel = AddSlider(oe.ctrlPanel, "Wind:", 0, 100.0, physicsnode.wind, 1);
82
+ windPanel = AddSlider(oe.ctrlPanel, "Wind:", 0, 10.0, physicsnode.wind, 1);
8383 windField = (cNumberSlider)windPanel.getComponent(1);
8484
8585 // oe.ctrlPanel.add(windLabel = new JLabel("Wind: ")); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
PhysicsNode.java
....@@ -112,7 +112,7 @@
112112
113113 void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
114114 {
115
- if (Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // FUCK
115
+ if (Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // SHADOW
116116 {
117117 float ms = getDeltaTimeMicroseconds();
118118 float minFPS = 1000000f / 60f;
RagDoll.java
....@@ -89,11 +89,11 @@
8989
9090 BODYPART_LEFT_UPPER_ARM,
9191 BODYPART_LEFT_LOWER_ARM,
92
- BODYPART_LEFT_HAND,
92
+ //BODYPART_LEFT_HAND,
9393
9494 BODYPART_RIGHT_UPPER_ARM,
9595 BODYPART_RIGHT_LOWER_ARM,
96
- BODYPART_RIGHT_HAND,
96
+ //BODYPART_RIGHT_HAND,
9797
9898 //BODYPART_GROUND,
9999
....@@ -114,11 +114,11 @@
114114
115115 JOINT_LEFT_SHOULDER,
116116 JOINT_LEFT_ELBOW,
117
- JOINT_LEFT_WRIST,
117
+ //JOINT_LEFT_WRIST,
118118
119119 JOINT_RIGHT_SHOULDER,
120120 JOINT_RIGHT_ELBOW,
121
- JOINT_RIGHT_WRIST,
121
+ //JOINT_RIGHT_WRIST,
122122
123123 JOINT_COUNT
124124 }
....@@ -174,19 +174,19 @@
174174
175175 shapes[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()] = new CapsuleShape(scale_ragdoll * 0.4f * thin, scale_ragdoll * 0.4f, node);
176176 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);
177
+ shapes[BodyPart.BODYPART_LEFT_FOOT.ordinal()] = new CapsuleShape(scale_ragdoll * 0.2f * thin, scale_ragdoll * 0.2f, node);
178178
179179 shapes[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()] = new CapsuleShape(scale_ragdoll * 0.4f * thin, scale_ragdoll * 0.4f, node);
180180 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);
181
+ shapes[BodyPart.BODYPART_RIGHT_FOOT.ordinal()] = new CapsuleShape(scale_ragdoll * 0.2f * thin, scale_ragdoll * 0.2f, node);
182182
183183 shapes[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()] = new CapsuleShape(scale_ragdoll * upperarmlength * thin, scale_ragdoll * upperarmlength, node);
184184 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);
185
+ //shapes[BodyPart.BODYPART_LEFT_HAND.ordinal()] = new CapsuleShape(scale_ragdoll * handlength * thin, scale_ragdoll * handlength, node);
186186
187187 shapes[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()] = new CapsuleShape(scale_ragdoll * upperarmlength * thin, scale_ragdoll * upperarmlength, node);
188188 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);
189
+ //shapes[BodyPart.BODYPART_RIGHT_HAND.ordinal()] = new CapsuleShape(scale_ragdoll * handlength * thin, scale_ragdoll * handlength, node);
190190 }
191191 //scale_ragdoll *= 1.25;
192192
....@@ -329,15 +329,15 @@
329329 body.getMotionState().setWorldTransform(tmpTrans);
330330 ((cRigidBody)body).anchor.set(tmpTrans.origin);
331331
332
- transform.setIdentity();
333
- if ((body = bodies[BodyPart.BODYPART_LEFT_HAND.ordinal()]) == null)
334
- body = bodies[BodyPart.BODYPART_LEFT_HAND.ordinal()] = localCreateRigidBody(1f, 0, transform, shapes[BodyPart.BODYPART_LEFT_HAND.ordinal()]);
335
- transform.origin.set(-(handlength/2 + lowerarmlength + upperarmlength + upperarmdist) * scale_ragdoll, 1.325f * scale_ragdoll, depth);
336
- MatrixUtil.setEulerZYX(transform.basis, 0, 0, BulletGlobals.SIMD_HALF_PI);
337
- tmpTrans.mul(offset, transform);
338
- body.worldTransform.set(tmpTrans);
339
- body.getMotionState().setWorldTransform(tmpTrans);
340
- ((cRigidBody)body).anchor.set(tmpTrans.origin);
332
+// transform.setIdentity();
333
+// if ((body = bodies[BodyPart.BODYPART_LEFT_HAND.ordinal()]) == null)
334
+// body = bodies[BodyPart.BODYPART_LEFT_HAND.ordinal()] = localCreateRigidBody(1f, 0, transform, shapes[BodyPart.BODYPART_LEFT_HAND.ordinal()]);
335
+// transform.origin.set(-(handlength/2 + lowerarmlength + upperarmlength + upperarmdist) * scale_ragdoll, 1.325f * scale_ragdoll, depth);
336
+// MatrixUtil.setEulerZYX(transform.basis, 0, 0, BulletGlobals.SIMD_HALF_PI);
337
+// tmpTrans.mul(offset, transform);
338
+// body.worldTransform.set(tmpTrans);
339
+// body.getMotionState().setWorldTransform(tmpTrans);
340
+// ((cRigidBody)body).anchor.set(tmpTrans.origin);
341341
342342 transform.setIdentity();
343343 if ((body = bodies[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()]) == null)
....@@ -359,15 +359,15 @@
359359 body.getMotionState().setWorldTransform(tmpTrans);
360360 ((cRigidBody)body).anchor.set(tmpTrans.origin);
361361
362
- transform.setIdentity();
363
- if ((body = bodies[BodyPart.BODYPART_RIGHT_HAND.ordinal()]) == null)
364
- body = bodies[BodyPart.BODYPART_RIGHT_HAND.ordinal()] = localCreateRigidBody(1f, 0, transform, shapes[BodyPart.BODYPART_RIGHT_HAND.ordinal()]);
365
- transform.origin.set((handlength/2 + lowerarmlength + upperarmlength + upperarmdist) * scale_ragdoll, 1.325f * scale_ragdoll, depth);
366
- MatrixUtil.setEulerZYX(transform.basis, 0, 0, -BulletGlobals.SIMD_HALF_PI);
367
- tmpTrans.mul(offset, transform);
368
- body.worldTransform.set(tmpTrans);
369
- body.getMotionState().setWorldTransform(tmpTrans);
370
- ((cRigidBody)body).anchor.set(tmpTrans.origin);
362
+// transform.setIdentity();
363
+// if ((body = bodies[BodyPart.BODYPART_RIGHT_HAND.ordinal()]) == null)
364
+// body = bodies[BodyPart.BODYPART_RIGHT_HAND.ordinal()] = localCreateRigidBody(1f, 0, transform, shapes[BodyPart.BODYPART_RIGHT_HAND.ordinal()]);
365
+// transform.origin.set((handlength/2 + lowerarmlength + upperarmlength + upperarmdist) * scale_ragdoll, 1.325f * scale_ragdoll, depth);
366
+// MatrixUtil.setEulerZYX(transform.basis, 0, 0, -BulletGlobals.SIMD_HALF_PI);
367
+// tmpTrans.mul(offset, transform);
368
+// body.worldTransform.set(tmpTrans);
369
+// body.getMotionState().setWorldTransform(tmpTrans);
370
+// ((cRigidBody)body).anchor.set(tmpTrans.origin);
371371
372372 // Setup some damping on the m_bodies
373373 for (int i = 0; i < BodyPart.BODYPART_COUNT.ordinal(); ++i)
....@@ -533,6 +533,7 @@
533533 /// *************************** ///
534534
535535 /// ******* LEFT WRIST ******** ///
536
+ /**
536537 if (links)
537538 {
538539 localA.setIdentity();
....@@ -556,9 +557,11 @@
556557 joints[JointType.JOINT_LEFT_WRIST.ordinal()] = joint6DOF;
557558 // ownerWorld.addConstraint(joints[JointType.JOINT_LEFT_WRIST.ordinal()], !selfcollision);
558559 }
560
+ /**/
559561 /// *************************** ///
560562
561563 /// ******* RIGHT WRIST ******** ///
564
+ /**
562565 if (links)
563566 {
564567 localA.setIdentity();
....@@ -582,6 +585,7 @@
582585 joints[JointType.JOINT_RIGHT_WRIST.ordinal()] = joint6DOF;
583586 // ownerWorld.addConstraint(joints[JointType.JOINT_RIGHT_WRIST.ordinal()], !selfcollision);
584587 }
588
+ /**/
585589
586590 /// ******* PELVIS ******** ///
587591 if (links)
....@@ -723,6 +727,7 @@
723727 /// *************************** ///
724728
725729 /// ******* LEFT ANKLE ******** ///
730
+ /**/
726731 if (links)
727732 {
728733 localA.setIdentity();
....@@ -746,9 +751,11 @@
746751 joints[JointType.JOINT_LEFT_ANKLE.ordinal()] = joint6DOF;
747752 // ownerWorld.addConstraint(joints[JointType.JOINT_LEFT_KNEE.ordinal()], !selfcollision);
748753 }
754
+ /**/
749755 /// *************************** ///
750756
751757 /// ******* RIGHT ANKLE ******** ///
758
+ /**/
752759 if (links)
753760 {
754761 localA.setIdentity();
....@@ -772,6 +779,7 @@
772779 joints[JointType.JOINT_RIGHT_ANKLE.ordinal()] = joint6DOF;
773780 // ownerWorld.addConstraint(joints[JointType.JOINT_RIGHT_KNEE.ordinal()], !selfcollision);
774781 }
782
+ /**/
775783 /// *************************** ///
776784
777785
com/bulletphysics/dynamics/RigidBody.java
....@@ -216,9 +216,15 @@
216216
217217 static Vector3f g = new Vector3f();
218218 static Vector3f w = new Vector3f();
219
+
219220 static public Vector3f wind = new Vector3f();
220221 static public Vector3f pos = new Vector3f();
221222
223
+ static public Vector3f min = new Vector3f();
224
+ static public Vector3f max = new Vector3f();
225
+
226
+ static public boolean justclicked;
227
+
222228 public void applyGravity() {
223229 if (isStaticOrKinematicObject())
224230 return;
....@@ -226,11 +232,25 @@
226232 g.y = gravity.y;
227233 applyCentralForce(g);
228234
229
- wind.set(pos);
230
- wind.x -= worldTransform.origin.x;
231
- wind.y -= worldTransform.origin.y;
232
- wind.z -= worldTransform.origin.z;
235
+ if (pos.x == 0 && pos.y == 0 && pos.z == 0)
236
+ return;
233237
238
+ justclicked = false;
239
+
240
+// wind.set(pos);
241
+// wind.x -= worldTransform.origin.x;
242
+// wind.y -= worldTransform.origin.y;
243
+// wind.z -= worldTransform.origin.z;
244
+
245
+// this.collisionShape.getAabb(worldTransform, min, max);
246
+//
247
+// if (pos.x < min.x || pos.x > max.x)
248
+// return;
249
+// if (pos.y < min.y || pos.y > max.y)
250
+// return;
251
+// if (pos.z < min.z || pos.z > max.z)
252
+// return;
253
+
234254 float dot = pos.x * wind.x + pos.y * wind.y + pos.z * wind.z;
235255
236256 dot = 10;
....@@ -238,6 +258,7 @@
238258 w.x = wind.x * gravity.z * dot;
239259 w.y = wind.y * gravity.z * dot;
240260 w.z = wind.z * gravity.z * dot;
261
+
241262 applyCentralForce(w);
242263 }
243264