Add ceiling rotation drag and refine ground/wall pose offset controls
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
080b2a1c39
commit
f652cdeca0
6 files changed
+407
-203
No files matched your search
@@ -89,8 +89,9 @@ public partial class PlayerPoseController : MonoBehaviour
|
||||
// evaluates. An AnimationClipPlayable only writes the bones its curves cover, so a clip that
|
||||
// doesn't key a bone (an empty clip like the T-pose, or a partial one) would otherwise leave that
|
||||
// bone frozen on the previous animation. Restoring this before each pose start makes every pose
|
||||
// define the full body. meshOffsetTarget is an ancestor of the Animator, so it is never in this
|
||||
// set and the controller's lean/ceiling offset stays untouched.
|
||||
// define the full body. The controller's model-offset transform (meshOffsetTarget) is explicitly
|
||||
// dropped from this set in CaptureRestPose — with the humanoid rig the Animator sits on that node,
|
||||
// so it is the root of this subtree, and resetting it would wipe the wall-lean / ceiling offset.
|
||||
private Transform[] _restBones;
|
||||
private Vector3[] _restPos;
|
||||
private Quaternion[] _restRot;
|
||||
@@ -336,6 +337,20 @@ public partial class PlayerPoseController : MonoBehaviour
|
||||
_restRot[i] = t.localRotation;
|
||||
_restScale[i] = t.localScale;
|
||||
}
|
||||
|
||||
// Drop the model-offset transform from the reset set so the per-frame ResetToRestPose never
|
||||
// touches it: the wall-lean / ceiling offset (PlayerCharacterController.SetMeshLean) is its sole
|
||||
// writer. With the humanoid rig the Animator shares this node, putting it in the captured subtree;
|
||||
// resetting it each frame is exactly what was wiping the offsets. Nulling the slot makes
|
||||
// ResetToRestPose's null-guard skip it. _player is resolved (and meshOffsetTarget too, since the
|
||||
// controller's Awake runs first at its lower execution order) before this runs.
|
||||
Transform offsetTarget = _player ? _player.MeshOffsetTarget : null;
|
||||
if (offsetTarget)
|
||||
{
|
||||
int idx = System.Array.IndexOf(_restBones, offsetTarget);
|
||||
if (idx >= 0)
|
||||
_restBones[idx] = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Restores the captured rest pose so an empty or partial pose clip fully defines the body.</summary>
|
||||
|
||||
Reference in new issue
Block a user