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:

alt text

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?

perhaps gauche to answer my own question, but I figured out a better solution :slight_smile:

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.