From 5906c108b8bfd0e2814f70b440857822f025f8de Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Fri, 1 May 2026 16:52:03 +0200 Subject: [PATCH] auto-git: [change] tests/unit/first-person-navigation-controller.test.ts --- ...first-person-navigation-controller.test.ts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/unit/first-person-navigation-controller.test.ts b/tests/unit/first-person-navigation-controller.test.ts index cf1d5626..7dc14792 100644 --- a/tests/unit/first-person-navigation-controller.test.ts +++ b/tests/unit/first-person-navigation-controller.test.ts @@ -622,6 +622,37 @@ describe("FirstPersonNavigationController", () => { }); }); + it("enters ledge grab instead of getting stuck when climbing reaches a high lip", () => { + const { context } = createFirstPersonLedgeGrabContext(); + + Object.assign(context, { + resolvePlayerClimbSurface: vi.fn(() => ({ + brushId: "brush-climbable-wall", + faceId: "negZ", + point: { x: 0, y: 1, z: 0.75 }, + normal: { x: 0, y: 0, z: -1 }, + distance: 0.75 + })) + }); + + const controller = new FirstPersonNavigationController(); + + controller.activate(context); + window.dispatchEvent(new KeyboardEvent("keydown", { code: "KeyW" })); + controller.update(0.05); + + const telemetry = + context.setPlayerControllerTelemetry.mock.calls.at(-1)?.[0]; + + expect(telemetry?.locomotionState.locomotionMode).toBe("ledgeGrab"); + expect(telemetry?.locomotionState.verticalVelocity).toBe(0); + + window.dispatchEvent(new KeyboardEvent("keyup", { code: "KeyW" })); + controller.deactivate(context, { + releasePointerLock: false + }); + }); + it("uses the gamepad right stick for camera look without requiring pointer lock", () => { const { context } = createRuntimeControllerContext(); const controller = new FirstPersonNavigationController();