Hi everyone!
I would like to create a automated Foot IK for my game.
My plan is to override my animations using the Two Bones IK Constraint component from the Animation Rigging package for each leg.
The difficulty for setting this up is to select - or more like to create - a Target object for the end of the IK chain.
The idea is to take the position of the leg bone, and then go up a bit, and then Raycast back down, so it would look like something like this:
Ray ray = new Ray((footLeft.transform.position + 0.5f * Vector3.up), Vector3.down);
RaycastHit rayHit;
if (Physics.Raycast(ray, out rayHit, 0.5f, 1 << LayerMask.NameToLayer("Environment")))
{
footLeftTarget.transform.position = rayHit.point;
}
else
{
footLeftTarget.transform.position = footLeft.transform.position;
}
The problem with this, is that the position of the footLeft bone will be already constrained, and I need the original position, which is the result of the original animation.
So my question is, is there a way to access to the original transform of a bone?
-Peter