I made this to change the left hand position, but i get this warning and is not working.
Setting and getting Body Position/Rotation, IK Goals, Lookat and BoneLocalRotation should only be done in OnAnimatorIK or OnStateIK
void Update()
{
OnAnimatorIK();
}
void OnAnimatorIK()
{
if (animator == null)
return;
if (leftHandIKTarget == null)
return;
if (leftHandIKTarget)
{
animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1);
animator.SetIKRotationWeight(AvatarIKGoal.LeftHand, 1);
Transform target = leftHandIKTarget;
Vector3 targetPos = target.position;
Quaternion targetRot = target.rotation;
animator.SetIKPosition(AvatarIKGoal.LeftHand, targetPos);
animator.SetIKRotation(AvatarIKGoal.LeftHand, targetRot);
Debug.Log("Test A");
}
else
{
animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 0);
animator.SetIKRotationWeight(AvatarIKGoal.LeftHand, 0);
Debug.Log("Test B");
}
}