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,
shape: FirstPersonPlayerShape
) => boolean;
options.probePlayerGround?.(feetPosition, shape, maxDistance) ??
{
grounded: true,
distance: 0,
normal: { x: 0, y: 1, z: 0 },
slopeDegrees: 0
},
} = {}
) {
const runtimeScene = buildRuntimeSceneFromDocument(
{
...createEmptySceneDocument({ name: "Pointer Lock Scene" }),
entities: {
[playerStart.id]: playerStart
}
},
@@ -327,23 +326,11 @@ describe("FirstPersonNavigationController", () => {
maxDistance: number
) => 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({
grounded: false,
distance: null,
normal: null,
slopeDegrees: null
grounded: true,
distance: 0,
normal: { x: 0, y: 1, z: 0 },
slopeDegrees: 0
})
}
);