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