void makeBody(DynamicsWorld ownerWorld, Vector3f positionOffset,
float scale_ragdoll) {
this.buildScale = scale_ragdoll;
Transform tmpTrans = new Transform();
Vector3f tmp = new Vector3f();
// Setup the geometry
shapes[BodyPart.BODYPART_PELVIS.ordinal()] = new CapsuleShape(
scale_ragdoll * 0.11f, scale_ragdoll * 0.20f);
shapes[BodyPart.BODYPART_SPINE.ordinal()] = new CapsuleShape(
scale_ragdoll * 0.13f, scale_ragdoll * 0.28f);
shapes[BodyPart.BODYPART_HEAD.ordinal()] = new CapsuleShape(
scale_ragdoll * 0.10f, scale_ragdoll * 0.1f);
shapes[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()] = new CapsuleShape(
scale_ragdoll * 0.08f, scale_ragdoll * 0.45f);
shapes[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()] = new CapsuleShape(
scale_ragdoll * 0.06f, scale_ragdoll * 0.45f);
shapes[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()] = new CapsuleShape(
scale_ragdoll * 0.08f, scale_ragdoll * 0.45f);
shapes[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()] = new CapsuleShape(
scale_ragdoll * 0.06f, scale_ragdoll * 0.45f);
if (hasArms) {
shapes[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()] = new CapsuleShape(
scale_ragdoll * 0.05f, scale_ragdoll * 0.33f);
shapes[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()] = new CapsuleShape(
scale_ragdoll * 0.04f, scale_ragdoll * 0.25f);
shapes[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()] = new CapsuleShape(
scale_ragdoll * 0.05f, scale_ragdoll * 0.33f);
shapes[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()] = new CapsuleShape(
scale_ragdoll * 0.04f, scale_ragdoll * 0.25f);
}
// Setup all the rigid bodies
Transform offset = new Transform();
offset.setIdentity();
offset.origin.set(positionOffset);
Transform transform = new Transform();
transform.setIdentity();
transform.origin.set(0f, scale_ragdoll * -1f, 0f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_PELVIS.ordinal()] = localCreateRigidBody(3f,
tmpTrans, shapes[BodyPart.BODYPART_PELVIS.ordinal()]);
transform.setIdentity();
transform.origin.set(0f, scale_ragdoll * -1.2f, 0f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_SPINE.ordinal()] = localCreateRigidBody(.1f,
tmpTrans, shapes[BodyPart.BODYPART_SPINE.ordinal()]);
transform.setIdentity();
transform.origin.set(0f, scale_ragdoll * -1.6f, 0f);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_HEAD.ordinal()] = localCreateRigidBody(.1f,
tmpTrans, shapes[BodyPart.BODYPART_HEAD.ordinal()]);
transform.setIdentity();
transform.origin.set(0f, -0.7f * scale_ragdoll, 0.08f * scale_ragdoll);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()] = localCreateRigidBody(
.7f, tmpTrans,
shapes[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()]);
transform.setIdentity();
transform.origin.set(0f, -0.2f * scale_ragdoll, 0.06f * scale_ragdoll);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()] = localCreateRigidBody(
1.0f, tmpTrans,
shapes[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()]);
transform.setIdentity();
transform.origin.set(0f, -0.7f * scale_ragdoll, -0.08f * scale_ragdoll);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()] = localCreateRigidBody(
.7f, tmpTrans,
shapes[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()]);
transform.setIdentity();
transform.origin.set(0f, -0.2f * scale_ragdoll, -0.08f * scale_ragdoll);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()] = localCreateRigidBody(
1.0f, tmpTrans,
shapes[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()]);
if (hasArms) {
transform.setIdentity();
transform.origin.set(0f, -1.75f * scale_ragdoll,
0.35f * scale_ragdoll);
MatrixUtil.setEulerZYX(transform.basis, BulletGlobals.SIMD_HALF_PI,
0, 0);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()] = localCreateRigidBody(
1f, tmpTrans,
shapes[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()]);
transform.setIdentity();
transform.origin.set(0f, -1.75f * scale_ragdoll,
0.7f * scale_ragdoll);
MatrixUtil.setEulerZYX(transform.basis, BulletGlobals.SIMD_HALF_PI,
0, 0);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()] = localCreateRigidBody(
1f, tmpTrans,
shapes[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()]);
transform.setIdentity();
transform.origin.set(0f, -1.75f * scale_ragdoll, -0.35f
* scale_ragdoll);
MatrixUtil.setEulerZYX(transform.basis,
-BulletGlobals.SIMD_HALF_PI, 0, 0);
tmpTrans.mul(offset, transform);
bodies[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()] = localCreateRigidBody(
1f, tmpTrans,
shapes[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()]);
transform.setIdentity();
transform.origin.set(0f, -1.75f * scale_ragdoll, -0.7f
* scale_ragdoll);
MatrixUtil.setEulerZYX(transform.basis,
-BulletGlobals.SIMD_HALF_PI, 0, 0);
tmpTrans.mul(offset, transform);