From 3fbb70a30c80dd5e0dafd81e27ea7cf9b2a719cf Mon Sep 17 00:00:00 2001 From: CAtlas0784 Date: Thu, 29 Oct 2026 00:32:03 +0700 Subject: [PATCH] Align FaceCam with animated head direction --- scripts/freecam.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/freecam.lua b/scripts/freecam.lua index 6c46f1d..5bb5cd4 100644 --- a/scripts/freecam.lua +++ b/scripts/freecam.lua @@ -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