CCDIK rig breaking when "parenting" to vehicle

I have a ccdik rig as part of a character, trying to pass the rig to a vehicle. I’m finding it really hard to get good rotations and world pos, the ccdik fails and the mesh just disappears.Something in the matrix transforms is failing. Using the direct rotations from the gui method sort of works, but not really.Is there some trick to this? It can work with transforms controls, gui adjustments, but for whatever reason passing values from another mesh just kills it.

When you directly pass transforms from one mesh/rig to another, especially for a CCD IK setup, you can run into mismatched coordinate spaces and unexpected rotations. Common pitfalls:

  1. Local vs. World Transforms: CCD typically expects local bone transforms. If you take a world rotation or position from a vehicle mesh and apply it directly, the IK might receive invalid bone data.
  2. Bone Rest Pose: IK depends on consistent initial bone lengths/orientations. If the rig is reoriented or attached to a new parent without adjusting the bind pose, it can break the solver.
  3. Parenting & Hierarchy: Ensure your character rig remains in the same hierarchical structure (or re-parent it carefully). Re-check that updateMatrixWorld() is called if needed.
  4. Matrix Decomposition: If you must convert from one object’s world transform to another’s local transform, decompose matrices properly:
object.matrixWorld.decompose(pos, quat, scale);
bone.worldToLocal(pos);
bone.quaternion.multiply(bone.getWorldQuaternion(new THREE.Quaternion()).invert()).multiply(quat);
  1. Debug Step by Step: Log each bone’s matrixWorld, position, and rotation to see where values diverge.
2 Likes

Omg this worked! Thank you so much! I was stuck on this for DAYS. When you’ve sunk so much time into making one part of the project you just assume would work easily and it gets stuck. I was going nuts. thanks you!

1 Like