void makeBody(DynamicsWorld ownerWorld, Vector3f positionOffset,
float scale_ragdoll) {
this.buildScale = scale_ragdoll;
Transform tmpTrans = new Transform();
Vector3f tmp = new Vector3f();
// Setup the geometry
int partNum = 0;
this.buildProportions();
// Setup some damping on the m_bodies
for (int i = 0; i < BodyPart.BODYPART_COUNT.ordinal(); ++i) {
shapes[i] = new CapsuleShape(limbWidths[i], limbLengths[i]);
}
// Setup all the rigid bodies
Transform offset = new Transform();
offset.setIdentity();
offset.origin.set(positionOffset);
Transform transform = new Transform();
transform.setIdentity();
transform.origin.set(42.00441f, 28.350739f, -1.8362772f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_HEAD.ordinal()] = localCreateRigidBody(
.06f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_HEAD.ordinal()]);
transform.setIdentity();
transform.origin.set(40.328167f, 34.438187f, -0.02232361f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_SPINE.ordinal()] = localCreateRigidBody(
1f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_SPINE.ordinal()]);
transform.setIdentity();
transform.origin.set(38.91143f, 39.836838f, 0.29198787f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_PELVIS.ordinal()] = localCreateRigidBody(
1f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_PELVIS.ordinal()]);
// transform.setIdentity();
// transform.origin.set(0f, scale_ragdoll * -1.6f, 0f);
// tmpTrans.mul(offset, transform);
// bodies[BodyPart.BODYPART_NECK.ordinal()] = localCreateRigidBody(.1f, tmpTrans, shapes[BodyPart.BODYPART_NECK.ordinal()]);
if (this.hasArms) {
transform.setIdentity();
transform.origin.set(41.880104f, 33.694458f, 2.016673f);
MatrixUtil.setEulerZYX(transform.basis,
-BulletGlobals.SIMD_HALF_PI, 0, 0);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()] = localCreateRigidBody(
.006f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()]);
transform.setIdentity();
transform.origin.set(42.41656f, 37.918385f, 0.61924f);
MatrixUtil.setEulerZYX(transform.basis,
-BulletGlobals.SIMD_HALF_PI, 0, 0);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()] = localCreateRigidBody(
.006f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()]);
transform.setIdentity();
transform.origin.set(42.514267f, 33.331062f, -3.8124154f);
MatrixUtil.setEulerZYX(transform.basis,
-BulletGlobals.SIMD_HALF_PI, 0, 0);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_LEFT_HAND.ordinal()] = localCreateRigidBody(
.006f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_LEFT_HAND.ordinal()]);
transform.setIdentity();
transform.setIdentity();
transform.origin.set(39.261406f, 46.36395f, 2.412697f);
MatrixUtil.setEulerZYX(transform.basis, BulletGlobals.SIMD_HALF_PI,
0, 0);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()] = localCreateRigidBody(
.006f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()]);
transform.setIdentity();
transform.origin.set(39.526512f, 54.545227f, 2.1793346f);
MatrixUtil.setEulerZYX(transform.basis, BulletGlobals.SIMD_HALF_PI,
0, 0);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()] = localCreateRigidBody(
.006f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()]);
transform.setIdentity();
transform.origin.set(42.192146f, 40.39129f, -1.8401904f);
MatrixUtil.setEulerZYX(transform.basis, BulletGlobals.SIMD_HALF_PI,
0, 0);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_RIGHT_HAND.ordinal()] = localCreateRigidBody(
.006f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_RIGHT_HAND.ordinal()]);
}
//LEFT LEG
transform.setIdentity();
transform.origin.set(39.261406f, 46.36395f, 2.412697f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()] = localCreateRigidBody(
1.2f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()]);
transform.setIdentity();
transform.origin.set(39.526512f, 54.545227f, 2.1793346f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()] = localCreateRigidBody(
.6f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()]);
transform.setIdentity();
transform.origin.set(39.758045f, 59.2257f, 2.0889432f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_LEFT_FOOT.ordinal()] = localCreateRigidBody(
.6f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_LEFT_FOOT.ordinal()]);
//RIGHT LEG
transform.setIdentity();
transform.origin.set(39.261406f, 46.36395f, -2.412697f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()] = localCreateRigidBody(
1.2f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()]);
transform.setIdentity();
transform.origin.set(39.526512f, 54.545227f, -2.1793346f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()] = localCreateRigidBody(
.6f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()]);
transform.setIdentity();
transform.origin.set(39.758045f, 59.2257f, -2.0889432f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_RIGHT_FOOT.ordinal()] = localCreateRigidBody(
0.6f * this.mass, tmpTrans,
shapes[BodyPart.BODYPART_RIGHT_FOOT.ordinal()]);
//Remembered positions
//BODYPART_HEAD
bodies[BodyPart.BODYPART_HEAD.ordinal()].getMotionState()
.getWorldTransform(transform);
transform.set(new Matrix4f(0.999522f, -0.02457619f, 0.01875775f,
103.311295f, 0.03083701f, 0.83602184f, -0.547829f,
22.693146f * this.scale, -0.0022183368f, 0.5481455f, 0.83638f,
-1.0370132f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
bodies[BodyPart.BODYPART_HEAD.ordinal()]
.setMotionState(new DefaultMotionState(transform));
//BODYPART_SPINE
bodies[BodyPart.BODYPART_SPINE.ordinal()].getMotionState()
.getWorldTransform(transform);
transform.setIdentity();
transform.set(new Matrix4f(0.9932064f, 0.116363324f, 7.786779E-4f,
104.067566f, -0.1162641f, 0.99203515f, 0.04846615f,
31.873365f * this.scale, 0.004867207f, -0.048227426f,
0.99882454f, 0.0021075667f * this.scale, 0.0f, 0.0f, 0.0f,
1.0f * this.scale));
bodies[BodyPart.BODYPART_SPINE.ordinal()]
.setMotionState(new DefaultMotionState(transform));
//BODYPART_PELVIS
bodies[BodyPart.BODYPART_PELVIS.ordinal()].getMotionState()
.getWorldTransform(transform);
transform.setIdentity();
transform.set(new Matrix4f(0.9835286f, 0.17898695f, -0.025202362f,
105.264946f, -0.18059899f, 0.97884035f, -0.09620573f,
40.34729f * this.scale, 0.007449517f, 0.099172615f, 0.9950424f,
0.04683579f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
bodies[BodyPart.BODYPART_PELVIS.ordinal()]
.setMotionState(new DefaultMotionState(transform));
//BODYPART_LEFT_UPPER_LEG
bodies[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()].getMotionState()
.getWorldTransform(transform);
transform.setIdentity();
transform.set(new Matrix4f(0.29188365f, 0.9564537f, -4.4153258E-4f,
109.79127f, -0.9526396f, 0.29067844f, -0.0893526f,
44.345417f * this.scale, -0.08533329f, 0.026501186f,
0.99599993f, 3.9808998f * this.scale, 0.0f, 0.0f, 0.0f,
1.0f * this.scale));
bodies[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()]
.setMotionState(new DefaultMotionState(transform));
//BODYPART_LEFT_LOWER_LEG
bodies[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()].getMotionState()
.getWorldTransform(transform);
transform.setIdentity();
transform.set(new Matrix4f(0.9873329f, -0.15865491f, 0.0015572663f,
115.62421f, 0.15813647f, 0.98321307f, -0.09102161f,
52.051834f * this.scale, 0.012909901f, 0.09011489f, 0.9958477f,
4.6894903f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
bodies[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()]
.setMotionState(new DefaultMotionState(transform));
//RIGHT_UPPER_LEG
bodies[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()].getMotionState()
.getWorldTransform(transform);
transform.setIdentity();
transform.set(new Matrix4f(0.23838913f, 0.9675928f, -0.08327571f,
110.01697f, -0.9671425f, 0.22872531f, -0.110996194f,
44.76596f * this.scale, -0.08835185f, 0.10699976f, 0.9903257f,
-2.6929f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
bodies[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()]
.setMotionState(new DefaultMotionState(transform));
//BODYPART_RIGHT_LOWER_LEG
bodies[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()].getMotionState()
.getWorldTransform(transform);
transform.setIdentity();
transform.set(new Matrix4f(0.9864584f, -0.14225316f, -0.081632055f,
116.022156f, 0.13265687f, 0.98470926f, -0.11291519f,
52.043633f * this.scale, 0.09644639f, 0.10055709f, 0.9902456f,
-1.3562305f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
bodies[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()]
.setMotionState(new DefaultMotionState(transform));
//BODYPART_RIGHT_FOOT
bodies[BodyPart.BODYPART_RIGHT_FOOT.ordinal()].getMotionState()
.getWorldTransform(transform);
transform.setIdentity();
transform.set(new Matrix4f(0.00923717f, 0.9967484f, -0.080045804f,
116.96003f, -0.99355465f, 1.0448694E-4f, -0.11335374f,
57.707912f * this.scale, -0.11297679f, 0.08057695f, 0.990325f,
-0.6338565f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
bodies[BodyPart.BODYPART_RIGHT_FOOT.ordinal()]
.setMotionState(new DefaultMotionState(transform));
//BODYPART_LEFT_FOOT
bodies[BodyPart.BODYPART_LEFT_FOOT.ordinal()].getMotionState()
.getWorldTransform(transform);
transform.setIdentity();
transform.set(new Matrix4f(-3.4880638E-4f, 0.99999404f, 0.0034378879f,
116.47286f, -0.9958018f, -3.2663345E-5f, -0.09153569f,
57.707455f * this.scale, -0.09153503f, -0.0034553856f,
0.99579585f, 5.203514f * this.scale, 0.0f, 0.0f, 0.0f,
1.0f * this.scale));
bodies[BodyPart.BODYPART_LEFT_FOOT.ordinal()]