Mecanim SetIKRotation completely broken

I’ve spent hours trying to fix this to no avail. No matter what I do with this character, I can’t get the hand IK rotation to point in the right direction.

I just want the right hand to rotate point in the direction of a point cast out from the camera.

Here’s a bit of code:

var rightHand : transform; //the right hand bone

function OnAnimatorIK(layerIndex : int){

		anim.SetLookAtWeight(lookAtWeight, 0.6, 0.75, 1.0, 0.35);
		anim.SetLookAtPosition(lookAtPos);
				
		anim.SetIKRotationWeight(AvatarIKGoal.RightHand, 1.0);
		anim.SetIKRotation(AvatarIKGoal.RightHand, Quaternion.LookRotation(lookAtPos - rightHand.position));
		
		Debug.DrawRay(rightHand.position, rightHand.forward, Color.red);
		Debug.DrawRay(rightHand.position, lookAtPos - rightHand.position, Color.green);
		
}

The right hand is pointing in a seemingly completely random direction, as you can see from my debug rays:

1266973--56104--$mecanim-ik-broken.jpg

All of a sudden, I have this exact same issue. Hand IK just randomly decided to stop working.

I realize I’m replying to a post from 3 years ago, so I might be a little bit too late, but a possible workaround would be to manually set the hand bone rotation in a LateUpdate(). Using Quaternion.Lerp() from the bone rotation to target rotation, you can pretty much get the same “IK rotation weight” behavior to controll how much rotation is applied.