Update player locomotion to consider immediate grounding

This commit is contained in:
2026-04-12 01:47:09 +02:00
parent ba7964c296
commit c575d6d042

View File

@@ -405,8 +405,13 @@ export function stepPlayerLocomotion(
// the controller back into grounded/stick-to-ground logic.
const ascendingFromPreviousFrame =
options.verticalVelocity > VERTICAL_ASCENT_EPSILON;
const canUseImmediateGrounding =
options.previousLocomotionState === undefined ||
options.previousLocomotionState.grounded;
const currentlyGrounded =
currentGroundProbe.grounded && !ascendingFromPreviousFrame;
currentGroundProbe.grounded &&
!ascendingFromPreviousFrame &&
canUseImmediateGrounding;
if (currentlyGrounded) {
coyoteTimeRemainingMs = options.movement.jump.coyoteTimeMs;