Refactor ground probing logic in first-person navigation controller tests
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user