Why does this work?
I have an FPS camera, whose position is tied to a marker (transform shown in first shot) set in front of the head - which has IK on - and is set to look at a raycast point emanating from the forward direction of the camera's transform.
My FPS script applies a local rotation to the camera's transform:
camera.transform.localRotation = Quaternion.Euler(verticalLookRotation, 0, 0);
This is the code that creates a Look At Position:
aimTargetPosition = camera.transform.forward * 500f;
And this is the head IK code:
animController.SetLookAtWeight(1f);
animController.SetLookAtPosition(aimTargetPosition);
The Camera Rotation and update Look at Position both occur in Update(), while the head IK occurs in the built-in OnAnimatorIK() function.
Why doesn't the camera rotate around it's transform point, which should in theory push the head's rotation further and further towards its limit? Instead the camera remains in alignment with the head (which is great), but why?!
P.S. the theory is that the following chain reaction occurs:
camera is set to a fixed rotation (e.g. 5 degrees)
the head rotates to aim at Look at Point
this changes the camera's world angle (even though it's local rotation remains unchanged)
the Look at Point moves further again, repeating step 2-4
Your answer
Follow this Question
Related Questions
Prevent Snapping from Custom Bone Rotation to Animation 0 Answers
Confused About Animation... 1 Answer
Unity IK Pass creates Animation lags. 0 Answers