Animation Rigging Two Bone IK Constraint and Damped Transform work inconsistently

I’m procedurally animating creatures generated randomly at runtime out of assorted body parts (all of which are skinned, rigged meshes). I’m using Two Bone IK Constraint and Damped Transforms, and they only work about half the time. For example, on a creature with four identical legs, usually two legs will work and two are frozen, but it isn’t consistent which legs work and which don’t – it could be the front two that work, diagonal, the left side, or it could be three legs that work and one is frozen. I’ve also seen legs that seem like they animated for one frame and then froze. I’ve tried having the RigBuilder and Animator on a parent critter object and using RigBuilder.Build to set up the leg Rigs after they’ve instantiated, having a RigBuilder and Animator on each leg, and pulling in legs directly from the Project folder in case there’s something wrong with how I normally instantiate them in a script. I also tried updating to the Unity 6 beta in case there was a version-specific bug, but I still have the same problem. I can’t make heads or tails of why this is happening, but I’m happy to provide a sample project and submit a bug report if this isn’t a known behavior.

It is suggested that you could show how your hierarchy structure and the components of rigging are set up. It would be even better if there is a video of how the actual animation works.

Sure! Please let me know if you see any errors in how I’ve got things set up – it would be great if I made a mistake I could fix easily.

Here is a recording of an animated creature walking. The yellow glowing spheres show the locations of the targets and hints. Two of its legs are correctly pointing toward the targets; the rest appear to be frozen in place.

Skitterworm Animation Debug Small

Here are images of the hierarchy, inspector, and the code that sets up the RigBuilder in the parent CritterVisuals component of one procedurally animated creature. This creature does include rigged (Two Bone IK) legs that are children of bones of a rigged (Damped Constraint) torso, but I’ve seen similar issues in creatures where the torsos are not rigged.



image
image
image

Please let me know if there’s any more information that would be helpful to provide. Thank you!

I figured out what was causing the limbs being frozen in place! The Target for the Two Bone IK Constraint was the child object of another object; the parent object was being moved using a script, so the child Target object’s position in world space was changing, but its position in local space was the same every frame. When I unparented the Target object and moved it around in local space, the leg started following it again.

Edited to add: I also found that the limbs seem to not work if they have the same name as another leg in the RigBuilder.

Edited again: Finally, I found that the limbs only work consistently if I set the critter gameObject with the RigBuilder script inactive in code before calling RigBuilder.Build(), then set the gameObject active again immediately afterwards. There’s probably a better way to set this up, but at least it’s working now.

2 Likes