[SOLVED] Problem using DynamicAnimControl on Mixamo model

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:

dac-issue

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

2 Likes

You can deal with self-collisions in various ways. The simplest way is to use setIgnoredHops() to increase the “ignored hops” parameter, which defaults to 1.

If that doesn’t solve the issue, let me know, and I’ll study your code.

1 Like

I added

dac.setIgnoredHops(20)

It made the ragdoll less twitchy, but didn’t solve the issue. :cry:

I appreciate the offer to look over my code! :hugs:
I’ve organized and documented all the relevant code at the bottom of this class (same as above).

1 Like

I’m on it.

I recall that last time I saw a similar issue, it was caused by specifying the wrong root bone. If so, it’ll be a simple fix—and extra incentive for me to improve the Minie documentation!

Update: You’ve got an unusual model. For one thing, the orientation and scale of the animations are very different from those of the bind pose.

1 Like

Now I’m very confused about the model:

  1. I’ve edited it to set all Spatial transforms to identity.
  2. None of the armature joints have initial/local/model scaling outside the range of 0.99 to 1.01
  3. None of the animation tracks have scaling outside the range of 0.99 to 1.01

When I load the edited model, it is tiny, but after I set an action on the AnimComposer, it immediately grows about 100x larger. (I’m working on a simple test app to demonstrate this phenomenon.)

Can anyone suggest an explanation?

2 Likes

I’ve had a few models I downloaded from sketchfab where the mesh was garbage until the animation system put things into a pose.

…don’t know if that’s what’s happening here or not. Very strange when it happens.

2 Likes

The armature object scale is at 1%

Perhaps that is what’s breaking it?

1 Like

Perhaps. I wonder what your asset pipeline is. When you converted the model from Blender to J3O, what intermediate format did you use, if any?

1 Like

Try armature.applyInitialPose(); after loading the model and see if makes any difference.

1 Like

GLTF embedded, with pretty much the default export settings.


I tried this:
Set the armature object scale → 100% in blender, then set the spatial scale → 1% in-game (to keep the model the same size, visually). Now the DAC is working properly! :tada:

So far I’m not seeing any side-effects in animation, so I guess that solves it…

Thanks for helping me with this! :hugs:

1 Like

I’d like to understand why armature scaling is a problem. There could be bugs in our glTF importer, or there could be bugs in DynamicAnimControl. Or both! But I have other projects on my mind.

Since you seem satisfied, I’m going to let this matter drop.

2 Likes

Ok :+1:
I took the liberty to open an issue on this.

4 Likes

I’ve resumed my investigation of this issue and will report my findings (if any) at GitHub.

2 Likes