I was following IK tutorial and i come to point that instead of drag&post object "rightHandObj" into script bar. I used find function to find it. First, I notes this !! Second, full arm stretch forward only !! I got no error. https://docs.unity3d.com/Manual/InverseKinematics.html Code (CSharp): protected Animator animator; public bool ikActive = false; public Transform rightHandObj; public Transform lookObj = null; public bool hand_on; void Start () { animator = GetComponent<Animator>(); } void update { rightHandObj = GameObject.Find("right_hand_1").transform; } //a callback for calculating IK void OnAnimatorIK() { if(animator) { if(ikActive) { if(lookObj != null) { animator.SetLookAtWeight(1); animator.SetLookAtPosition(lookObj.position); } if(rightHandObj != null) { animator.SetIKPositionWeight(AvatarIKGoal.RightHand,1); animator.SetIKRotationWeight(AvatarIKGoal.RightHand,1); animator.SetIKPosition(AvatarIKGoal.RightHand,rightHandObj.position); animator.SetIKRotation(AvatarIKGoal.RightHand,rightHandObj.rotation); } } else { animator.SetIKPositionWeight(AvatarIKGoal.RightHand,0); animator.SetIKRotationWeight(AvatarIKGoal.RightHand,0); animator.SetLookAtWeight(0); } } } If I dropped object inside script bar and delete find line, script run without any problem.
Is not touching "lookObj". I think it was a glitch or bug. Today after I turn on my PC, I play the engine and every thing working fine !! I'm still using 2018.1. Update: Its a bug. Now i get back to the same issue. I will update to 2018.2.
Where are you setting lookObj in your code? Currently you are initializing it to null. You are setting a value for Right Hand Obj in the Inspector, but not lookObj.
Yes. Drag and drop. Thanks god that I notes it. Or i will spend full day reading and searching. No need to worry.
P.S. script edited. Sorry for misunderstanding. In line 23, You will see that body weight rotate to LookObj. There is no range from 0 to 1. I post the lookObj from the Inspector. About right_hand_1, I want this script find object call "right_hand_1" and post it on "rightHandObj" bar or space [image above]. No need for "setting a value". As i said before, I get no error from the script. but it doesn't do his job. what i mean, right hand doesn't grab cylinder as this image show. It not that bug only I saw. here another bug with animation window. there are not animation elements at all. but if i turnoff/on unity, all things will get back run well without single error !!!