- Home /
Have IK track point when it is a child of the animator but not the rig.
So to explain my somewhat confusing title here is a picture of my hierarchy.
The animator component for my rig is on the "Parent" object. The armature/mesh is a child of the "PlayerRig" object "IKTARGET" is just a transform that I'm using as my IK target.
The problem I am having is that when i rotate my "PlayerRig" object the rigs hand doesn't track the ik's global position. here is a gif to demonstrate this.
What I want is for the hand to always track the ik's global position regardless of the rotation of the PlayerRig object.
This normally works well when the animator / ikcontrol script is on the rig itself. However for my project I need it to be on my parent object so I can network sync the animator.
This is the relevant code on the IK controller script that I'm using:
void OnAnimatorIK(){
animator.SetIKPositionWeight (AvatarIKGoal.RightHand, 1);
animator.SetIKPosition (AvatarIKGoal.RightHand, rightHandIKPoint.position);
}
I have also tried:
animator.SetIKPosition (AvatarIKGoal.RightHand, rightHandIKPoint.position+(rightHandIKPoint.position-rigTotal.position));(rightHandIKPoint.position-HandTransform.position));
//HandTransform is the transform of the rigs hand
While this allows for some tracking when the rig is rotated there is some inconsistent offsetting of the hand from the ikTarget.
Hope someone can give me some pointers!
Thanks!