fix(physics): jump apex velocity zeroing bug

SmallVelocity threshold (0.25 m/s) in UpdatePhysicsInternal was zeroing
velocity every frame while airborne at the jump apex. With vel~0.01 m/s
and gravity adding only 0.012/frame, the zeroing won every frame and
the character got stuck at peak height forever.

Fix: only apply small-velocity zeroing when OnWalkable (grounded).
While airborne, gravity must accumulate freely through the zero-crossing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-14 10:13:27 +02:00
parent 157ed9d974
commit 31cd5480dc
3 changed files with 32 additions and 8 deletions

View file

@ -960,21 +960,22 @@ public sealed class GameWindow : IDisposable
&& newCycle.HighFrame > newCycle.LowFrame
&& newCycle.Animation.PartFrames.Count > 1;
if (!newCycleIsGood)
return;
// Wire server-echoed RunRate into the player's MotionInterpreter.
// The server broadcasts the character's real Run-skill-derived ForwardSpeed
// in UpdateMotion; without this the player would always move at 4.0 m/s
// (ForwardSpeed = 1.0 hardcoded in MotionInterpreter defaults).
// Wire server-echoed RunRate BEFORE the animation early-return.
// If the cycle can't resolve (bad stance), we still need the speed.
if (_playerController is not null
&& update.Guid == _playerServerGuid
&& update.MotionState.ForwardSpeed.HasValue
&& update.MotionState.ForwardSpeed.Value > 0f)
{
Console.WriteLine($"DEBUG RunRate: guid={update.Guid:X8} fwd={update.MotionState.ForwardSpeed.Value:F3}");
_playerController.ApplyServerRunRate(update.MotionState.ForwardSpeed.Value);
}
if (!newCycleIsGood)
return;
// (RunRate wiring moved above the early-return)
// Sequencer path
if (ae.Sequencer is not null)
{