Hi there,
I’m trying to get my head around placing feet with mecanim. I got the very basics, I can move and align feet any way I want but but I can’t get my head around how FK / IK works exactly.
Let’s say that I want to place humanoid’s left foot, I first get it like this:
* *footL = animator.GetBoneTransform(HumanBodyBones.LeftFoot);* *
I didn’t find any other method to do this, and of course there is way to expose more rig nodes in import settings of model to show foot transforms, but I think it doesn’t add anything to this method. So it seem that I got the position of foot.
Then if I set in the same frame left foot to new position in OnAnimatorIK() method:
*_</em> <em><em>*animator.SetIKPosition(AvatarIKGoal.LeftFoot, newPos); animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot, 1f);*</em></em> <em>_*
Now, when we arrive to next frame, what position does the footL actually show ?
I haven’t quite been able to verify this, maybe it’s I’ve been testing this too long today… To me it seems there is no clean FK-position available in Mecanim that is based on animation clip data. Seems like foot position is it’s last frame position - where it ended up because I moved it with IK.
And what is the execution order of OnAnimatorIK() method compared to Update and FixedUpdate?
The reason I’m asking, I haven’t been able to plant feet properly in dynamic situations, seems like if I move a box under character’s feet in a simple case it seemed OK, but at some point it seems my calculated values are somehow piled up, and animation gets offset or starts jumping between two positions.
Obviously I’ve done something wrong…Any help appreciated, and if there are some good examples/tutorials on this, I’d be interested. Manual chapter on IK is not very helpful.