I’m experiencing a problem with DynamicAnimControl where it seems to have trouble with self-collisions. As soon as I activate ragdoll mode, it folds up like this:
Here’s how I set up the ragdoll:
private void initRagdoll() {
dac = new DynamicAnimControl();
dac.setMass(DacConfiguration.torsoName, 1f);
// a simple range of motion for testing
var motion = new RangeOfMotion(.5f, -.5f, .5f, -.5f, .5f, -.5f);
//link(dac, "Hips", 1f, motion);
link(dac, "Spine", 1f, copyMotion(motion));
link(dac, "Spine1", 1f, copyMotion(motion));
link(dac, "Spine2", 1f, copyMotion(motion));
link(dac, "Neck", 1f, copyMotion(motion));
//link(dac, "Head", 1f, copyMotion(motion));
//link(dac, "LeftShoulder", 1f, copyMotion(motion));
link(dac, "LeftArm", 1f, copyMotion(motion));
link(dac, "LeftForeArm", 1f, copyMotion(motion));
//link(dac, "LeftHand", 1f, copyMotion(motion));
//link(dac, "RightShoulder", 1f, copyMotion(motion));
link(dac, "RightArm", 1f, copyMotion(motion));
link(dac, "RightForeArm", 1f, copyMotion(motion));
//link(dac, "RightHand", 1f, copyMotion(motion));
link(dac, "LeftUpLeg", 1f, copyMotion(motion));
link(dac, "LeftLeg", 1f, copyMotion(motion));
//link(dac, "LeftFoot", 1f, copyMotion(motion));
link(dac, "RightUpLeg", 1f, copyMotion(motion));
link(dac, "RightLeg", 1f, copyMotion(motion));
//link(dac, "RightFoot", 1f, copyMotion(motion));
// add DAC to the same spatial as SkinningControl
skin.getSpatial().addControl(dac);
getPhysicsSpace().add(dac);
}
private void link(DynamicAnimControl dac, String joint, float mass, RangeOfMotion motion) {
dac.link("mixamorig:"+joint, mass, motion);
}
private RangeOfMotion copyMotion(RangeOfMotion motion) {
return new RangeOfMotion(
motion.getMaxRotation(0), motion.getMinRotation(0),
motion.getMaxRotation(1), motion.getMinRotation(1),
motion.getMaxRotation(2), motion.getMinRotation(2));
}
And this is how I trigger it later:
getPhysicsSpace().remove(control); // remove BetterCharacterControl
dac.setRagdollMode();
If I set the range of motion to zero on everything, it still folds up like above, but with less twitching. I have tried unlinking more bones, but that doesn’t work either.
Full code can be found here.
The model can be found here.
I’m using Minie 7.6