Add per-pose camera target Y offset and route ceiling offset to camera

Add cameraTargetYOffset to PlayerPose so each pose can offset the
Cinemachine ThirdPersonCamera follow/look target independently of the
body mesh. PlayerCharacterController gains a cameraTarget reference
(auto-resolved via the "CameraTarget" child, base position captured in
Awake) and a single-writer SetCameraTargetLocalYOffset. PlayerPoseController
eases the per-pose camera offset and composes it with the shared ceiling
offset, so the camera target follows the ceiling lift in lockstep with the
mesh. Wire cameraTarget explicitly in SampleScene.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 4.8 committed 2026-06-26 22:01:43 +02:00
1 parent ba7f8804c5
commit 0edc59555a
4 files changed
+51 -1

No files matched your search

+9
View File
@@ -41,6 +41,12 @@ public class PlayerPose : ScriptableObject
"hangs at the right height. Ignored on the ground and on walls. Meters.")]
[SerializeField] private float ceilingYOffset;
[Tooltip("Local-up offset applied to the camera target (the ThirdPersonCamera's follow/look target) " +
"while this pose is active, in ANY state. Frames the pose by raising/lowering what the camera " +
"tracks, without moving the body. The ceiling offset is added on top of this while on the " +
"ceiling. Meters.")]
[SerializeField] private float cameraTargetYOffset;
/// <summary>Idle clip held while the player stands still in this pose (may be null).</summary>
public AnimationClip Clip => clip;
@@ -61,4 +67,7 @@ public class PlayerPose : ScriptableObject
/// <summary>Local-up offset applied to the model only while on the ceiling.</summary>
public float CeilingYOffset => ceilingYOffset;
/// <summary>Local-up offset applied to the camera target while this pose is active (any state).</summary>
public float CameraTargetYOffset => cameraTargetYOffset;
}