I’m trying to have a wrapper object control the Animator IK but it doesn’t seem to work. The OnAnimatorIK() is not called unless its on the same object as the Animator component. I suppose it makes sense.
I suppose the only way to handle this is to have a proxy which is placed with the Animator that handles the OnAnimatorIK() pass while i control variables from the parent object’s scripts?
Example code I’m using below. Is there a different way to do this or do I need to make a proxy?
using UnityEngine;
using System.Collections;
public class IKthing : MonoBehaviour
{
public Transform objToPickUp;
public GameObject goWithAnimator;
private Animator animator;
void Start()
{
animator = goWithAnimator.GetComponent<Animator>();
}
void OnAnimatorIK()
{
Debug.Log("Doing IK pass.");
float reach = 1f;
animator.SetIKPositionWeight(AvatarIKGoal.RightHand, reach);
animator.SetIKPosition(AvatarIKGoal.RightHand, objToPickUp.position);
}
}