Refactor ground probing logic in first-person navigation controller tests

This commit is contained in:
2026-04-11 19:20:32 +02:00
parent c15d5e9d6a
commit 872630b71e

View File

@@ -51,13 +51,12 @@ function createRuntimeControllerContext(
feetPosition: Vec3, feetPosition: Vec3,
shape: FirstPersonPlayerShape shape: FirstPersonPlayerShape
) => boolean; ) => boolean;
options.probePlayerGround?.(feetPosition, shape, maxDistance) ?? } = {}
{ ) {
grounded: true, const runtimeScene = buildRuntimeSceneFromDocument(
distance: 0, {
normal: { x: 0, y: 1, z: 0 }, ...createEmptySceneDocument({ name: "Pointer Lock Scene" }),
slopeDegrees: 0 entities: {
},
[playerStart.id]: playerStart [playerStart.id]: playerStart
} }
}, },
@@ -327,23 +326,11 @@ describe("FirstPersonNavigationController", () => {
maxDistance: number maxDistance: number
) => PlayerGroundProbeResult ) => PlayerGroundProbeResult
>() >()
.mockReturnValueOnce({
grounded: true,
distance: 0,
normal: { x: 0, y: 1, z: 0 },
slopeDegrees: 0
})
.mockReturnValueOnce({
grounded: true,
distance: 0,
normal: { x: 0, y: 1, z: 0 },
slopeDegrees: 0
})
.mockReturnValue({ .mockReturnValue({
grounded: false, grounded: true,
distance: null, distance: 0,
normal: null, normal: { x: 0, y: 1, z: 0 },
slopeDegrees: null slopeDegrees: 0
}) })
} }
); );