fix(camera): pin chase-camera Z to last-grounded while airborne

K-fix11 (150 ms exponential lag) wasn't aggressive enough — at
0.15 s time constant the camera catches up to ~96 % of the
player's Z before peak, so the visible "rise on screen" was
maybe ~0.5 m of the 3.11 m arc. User reported the jump still
looked short.

K-fix12: replace the lag with an explicit airborne-pin. The
camera's tracked Z follows player Z directly while grounded,
but stays PINNED while airborne and rising. Falling / dropping
catches up immediately so we don't end up below ground when
landing in a hole.

Effect: during a jump the player visibly rises 3 m above the
camera on screen, matching retail's "you can see yourself jump"
feel. After landing the camera's tracked Z snaps back to the
player Z so there's no lingering vertical offset.

ChaseCamera.Update gains an isOnGround parameter; GameWindow
passes result.IsOnGround from the per-frame movement controller.
The look-at point still uses raw player Z so the camera tilts up
to keep the airborne character framed.

Tests stay 1222 green.
This commit is contained in:
Erik 2026-04-26 18:23:02 +02:00
parent 05ce090346
commit 4b6fcffa01
2 changed files with 41 additions and 35 deletions

View file

@ -3987,11 +3987,16 @@ public sealed class GameWindow : IDisposable
_worldState.RelocateEntity(pe, currentLb);
}
// Update chase camera. K-fix11 (2026-04-26): pass dt so the
// Z-smoothing low-pass filter tracks correctly on variable
// frame rates — without this the camera tracks player.Z 1:1
// and jumps look invisible (camera rises with player).
_chaseCamera.Update(result.Position, _playerController.Yaw, (float)dt);
// Update chase camera. K-fix12 (2026-04-26): pass isOnGround
// so the camera pins its Z to last-grounded while the
// player is airborne — without this the camera follows
// player.Z 1:1 during a jump and the player's screen
// position never changes. With the pin: player visibly
// rises above the camera, matching retail "you can see
// yourself jump" feedback.
_chaseCamera.Update(result.Position, _playerController.Yaw,
isOnGround: result.IsOnGround,
dt: (float)dt);
// Send outbound movement messages to the live server.
if (_liveSession is not null)