Align FaceCam with animated head direction
This commit is contained in:
1 parent
85946a3996
commit
3fbb70a30c
1 file changed
+3
-4
+3
-4
@@ -153,11 +153,10 @@ local function update_facecam(cam, settings)
|
||||
anchor = GameObject('GaC_FaceCamAnchor')
|
||||
anchor.transform:SetParent(head, false)
|
||||
_G.__FC_FACE_ANCHOR = anchor
|
||||
-- Capture the character's forward direction in the head's local
|
||||
-- space: this respects the model's bone axes and follows head turns.
|
||||
_G.__FC_FACE_LOCAL_FORWARD = CS.UnityEngine.Quaternion.Inverse(head.rotation) * root.forward
|
||||
end
|
||||
local direction = head.rotation * _G.__FC_FACE_LOCAL_FORWARD
|
||||
-- The observed game rig uses Head_M's local up axis as its facial
|
||||
-- direction; model-root forward does not follow the animated pose.
|
||||
local direction = head.up
|
||||
anchor.transform.position = target + direction * distance
|
||||
anchor.transform.rotation = CS.UnityEngine.Quaternion.LookRotation(target - anchor.transform.position, Vector3.up)
|
||||
cam.transform.position = anchor.transform.position
|
||||
|
||||
Reference in new issue
Block a user