Add per-pose fall animation state and clip
Play a dedicated falling animation when the player is airborne and descending past a scale-aware velocity threshold. - PlayerCharacterController: new IsFalling state + Fall Animation Speed threshold (true only when !grounded && !wallClimbing && descending, scaled via CapsuleScale); explicitly false during wall/ceiling climb. - PlayerPose: per-pose Fall Clip + Fall Clip Speed (mirrors walk/run). - PlayerPoseController: select the fall clip while falling, fall back to the idle clip when a pose has none (no regression). - Author content: Paintman-Fall.anim assigned to Pose_Idle; UMotion project, Player prefab and scene authoring. - Docs: check off the fall animation in GAME_DESIGN.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
fc73e26da1
commit
3b26f2e622
10 files changed
+11515
-101
No files matched your search
@@ -147,11 +147,12 @@ public partial class PlayerPoseController : MonoBehaviour
|
||||
|
||||
PlayerPose pose = ActivePose();
|
||||
|
||||
// Pick the clip for the current locomotion state. Standing still, airborne, on a wall or on the
|
||||
// ceiling holds the idle pose; moving on the ground plays the run clip while sprinting or the
|
||||
// walk clip otherwise. Both locomotion clips are optional — a null one falls back to the idle
|
||||
// pose, so an unset walk clip keeps the held-pose behaviour. PlayPose crossfades on any change
|
||||
// and hands the rig back only when there is no clip at all (empty list / null idle clip).
|
||||
// Pick the clip for the current locomotion state. Standing still, on a wall or on the ceiling
|
||||
// holds the idle pose; moving on the ground plays the run clip while sprinting or the walk clip
|
||||
// otherwise; falling (airborne and descending past the controller's threshold) plays the fall
|
||||
// clip. All three extra clips are optional — a null one falls back to the idle pose, so an unset
|
||||
// clip keeps the held-pose behaviour. PlayPose crossfades on any change and hands the rig back
|
||||
// only when there is no clip at all (empty list / null idle clip).
|
||||
AnimationClip clip = pose ? pose.Clip : null;
|
||||
float speed = pose ? pose.ClipSpeed : 1f;
|
||||
if (pose && _player.IsMovingOnGround)
|
||||
@@ -163,6 +164,11 @@ public partial class PlayerPoseController : MonoBehaviour
|
||||
speed = _player.IsSprinting ? pose.RunClipSpeed : pose.WalkClipSpeed;
|
||||
}
|
||||
}
|
||||
else if (pose && _player.IsFalling && pose.FallClip)
|
||||
{
|
||||
clip = pose.FallClip;
|
||||
speed = pose.FallClipSpeed;
|
||||
}
|
||||
PlayPose(clip, speed);
|
||||
|
||||
// CharacterController capsule: each pose carries its own center Y / radius / height so a low pose
|
||||
|
||||
Reference in new issue
Block a user