From 196597bd3ccb296dba3333a427c05b55207b9e06 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Fri, 1 May 2026 16:48:45 +0200 Subject: [PATCH] auto-git: [change] src/runtime-three/third-person-navigation-controller.ts --- .../third-person-navigation-controller.ts | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/runtime-three/third-person-navigation-controller.ts b/src/runtime-three/third-person-navigation-controller.ts index ff6f0d90..faecc516 100644 --- a/src/runtime-three/third-person-navigation-controller.ts +++ b/src/runtime-three/third-person-navigation-controller.ts @@ -620,7 +620,7 @@ export class ThirdPersonNavigationController implements NavigationController { inputState, movementYawRadians ); - const edgeAssist = + const shouldTryEdgeAssist = edgeInputDirection.direction !== null && shouldAttemptPlayerEdgeAssist({ enabled: playerMovement.edgeAssist.enabled, @@ -631,7 +631,9 @@ export class ThirdPersonNavigationController implements NavigationController { planarSpeed: locomotionStep.locomotionState.planarSpeed, collisionCount: locomotionStep.locomotionState.contact.collisionCount, airborne: locomotionStep.locomotionState.locomotionMode === "airborne" - }) + }); + const edgeAssist = + shouldTryEdgeAssist && edgeInputDirection.direction !== null ? resolvePlayerEdgeAssistTopOut({ feetPosition: locomotionStep.feetPosition, shape: locomotionStep.activeShape, @@ -653,6 +655,40 @@ export class ThirdPersonNavigationController implements NavigationController { } }) : null; + + if ( + edgeAssist === null && + shouldTryEdgeAssist && + edgeInputDirection.direction !== null + ) { + const ledgeGrabTarget = resolvePlayerLedgeGrabTarget({ + feetPosition: locomotionStep.feetPosition, + shape: locomotionStep.activeShape, + direction: edgeInputDirection.direction, + pushToTopHeight: playerMovement.edgeAssist.pushToTopHeight, + canOccupyShape: (feetPosition, shape) => + this.context?.canOccupyPlayerShape?.(feetPosition, shape) ?? true, + probeGround: (feetPosition, shape, maxDistance) => + this.context?.probePlayerGround?.( + feetPosition, + shape, + maxDistance + ) ?? { + grounded: false, + distance: null, + normal: null, + slopeDegrees: null + } + }); + + if (ledgeGrabTarget !== null) { + this.enterLedgeGrab(ledgeGrabTarget, edgeInputDirection.inputMagnitude); + this.updateCameraTransform(dt); + this.publishTelemetry(); + return; + } + } + const nextFeetPosition = edgeAssist === null ? locomotionStep.feetPosition : edgeAssist.feetPosition; const nextLocomotionState =