- Home /
Mecanim - best function to manually move root bone for IK?
I'm attempting to set up foot placement/rotation similar to Rune's old locomotion system in mecanim with the new IK system.
So far so good, but one thing that is kind of a prerequisite for such a thing is, the root bone of the armature needs to be moved down, by an amount equal to the offset between the lowest IK target foot y position, and the default ground y position.
For example, if a character is straddling the edge of two stairs, like this:
the character's collider is on the upper step, but the ik target position for the right foot (being raycasted down), is on the lower step. so I had to move the root bone of the armature down by an amount equal to the difference between the right foot target position and the normal ground height, so the right foot IK could actually reach its position.
I'm currently doing it in LateUpdate(), but manually moving the root bone in the armature screws up all the other calculations for my target positions for the IK, because that offset also applies to them (being children of the root bone), so I need to take that into account and add or subtract the same offsets from their positions.
Is there a better way to do it? Am I making any sense?
What happens if you do it in OnAnimatorI$$anonymous$$()?
Answer by PrimeDerektive · May 15, 2013 at 12:23 AM
perhaps gauche to answer my own question, but I figured out a better solution :)
Rather than attempt to move the armature root down, I decided to lerp the collider center up. That way I could do it in update because I'm not screwing with the rig bones, and it works like a charm.
Your answer
Follow this Question
Related Questions
Using SetIKPosition the final hand position is offset from target 2 Answers
Mecanim ik + musles 1 Answer
Mecanim IK Foot Rotation 2 Answers
Unity networking IK 0 Answers
Mecanim ignore root bone rotation 1 Answer