From 852cef56ac066e173110b031beda4be5bc809afa Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 11 Apr 2026 21:44:10 +0200 Subject: [PATCH] Add previous planar displacement tracking in ThirdPersonNavigationController --- .../third-person-navigation-controller.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/runtime-three/third-person-navigation-controller.ts b/src/runtime-three/third-person-navigation-controller.ts index 0b1460f0..b2d82dbd 100644 --- a/src/runtime-three/third-person-navigation-controller.ts +++ b/src/runtime-three/third-person-navigation-controller.ts @@ -124,6 +124,11 @@ export class ThirdPersonNavigationController implements NavigationController { private previousTelemetry: PlayerControllerTelemetry | null = null; private latestJumpStarted = false; private latestHeadBump = false; + private previousPlanarDisplacement = { + x: 0, + y: 0, + z: 0 + }; private jumpBufferRemainingMs = 0; private coyoteTimeRemainingMs = 0; private jumpHoldRemainingMs = 0; @@ -194,6 +199,11 @@ export class ThirdPersonNavigationController implements NavigationController { this.jumpPressed = false; this.latestJumpStarted = false; this.latestHeadBump = false; + this.previousPlanarDisplacement = { + x: 0, + y: 0, + z: 0 + }; this.jumpBufferRemainingMs = 0; this.coyoteTimeRemainingMs = 0; this.jumpHoldRemainingMs = 0; @@ -233,6 +243,11 @@ export class ThirdPersonNavigationController implements NavigationController { this.previousTelemetry = null; this.latestJumpStarted = false; this.latestHeadBump = false; + this.previousPlanarDisplacement = { + x: 0, + y: 0, + z: 0 + }; this.jumpBufferRemainingMs = 0; this.coyoteTimeRemainingMs = 0; this.jumpHoldRemainingMs = 0; @@ -271,6 +286,7 @@ export class ThirdPersonNavigationController implements NavigationController { standingShape: this.standingPlayerShape, verticalVelocity: this.verticalVelocity, previousLocomotionState: this.locomotionState, + previousPlanarDisplacement: this.previousPlanarDisplacement, jumpBufferRemainingMs: this.jumpBufferRemainingMs, coyoteTimeRemainingMs: this.coyoteTimeRemainingMs, jumpHoldRemainingMs: this.jumpHoldRemainingMs, @@ -314,6 +330,7 @@ export class ThirdPersonNavigationController implements NavigationController { this.latestJumpStarted = locomotionStep.jumpStarted; this.latestHeadBump = locomotionStep.headBump; this.locomotionState = locomotionStep.locomotionState; + this.previousPlanarDisplacement = locomotionStep.planarDisplacement; this.grounded = locomotionStep.locomotionState.grounded; this.inWaterVolume = locomotionStep.inWaterVolume; this.inFogVolume = locomotionStep.inFogVolume; @@ -356,6 +373,11 @@ export class ThirdPersonNavigationController implements NavigationController { this.previousTelemetry = null; this.latestJumpStarted = false; this.latestHeadBump = false; + this.previousPlanarDisplacement = { + x: 0, + y: 0, + z: 0 + }; this.jumpBufferRemainingMs = 0; this.coyoteTimeRemainingMs = 0; this.jumpHoldRemainingMs = 0;