Update player locomotion test with movement template and additional state properties

This commit is contained in:
2026-04-11 20:20:40 +02:00
parent c351084c0f
commit 5b573d48d0

View File

@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import type { Vec3 } from "../../src/core/vector"; import type { Vec3 } from "../../src/core/vector";
import { createPlayerStartMovementTemplate } from "../../src/entities/entity-instances";
import { FIRST_PERSON_PLAYER_SHAPE } from "../../src/runtime-three/player-collision"; import { FIRST_PERSON_PLAYER_SHAPE } from "../../src/runtime-three/player-collision";
import type { import type {
PlayerGroundProbeResult, PlayerGroundProbeResult,
@@ -10,14 +11,15 @@ import { stepPlayerLocomotion } from "../../src/runtime-three/player-locomotion"
import type { PlayerStartActionInputState } from "../../src/runtime-three/player-input-bindings"; import type { PlayerStartActionInputState } from "../../src/runtime-three/player-input-bindings";
import type { RuntimePlayerMovement } from "../../src/runtime-three/runtime-scene-build"; import type { RuntimePlayerMovement } from "../../src/runtime-three/runtime-scene-build";
const movementTemplate = createPlayerStartMovementTemplate();
const DEFAULT_MOVEMENT: RuntimePlayerMovement = { const DEFAULT_MOVEMENT: RuntimePlayerMovement = {
templateKind: "default", templateKind: "default",
moveSpeed: 4.5, moveSpeed: movementTemplate.moveSpeed,
capabilities: { capabilities: movementTemplate.capabilities,
jump: true, jump: movementTemplate.jump,
sprint: true, sprint: movementTemplate.sprint,
crouch: true crouch: movementTemplate.crouch
}
}; };
const FORWARD_INPUT: PlayerStartActionInputState = { const FORWARD_INPUT: PlayerStartActionInputState = {
@@ -52,6 +54,9 @@ function stepForwardOnSlope(normal: Vec3) {
standingShape: FIRST_PERSON_PLAYER_SHAPE, standingShape: FIRST_PERSON_PLAYER_SHAPE,
verticalVelocity: 0, verticalVelocity: 0,
previousLocomotionState: undefined, previousLocomotionState: undefined,
jumpBufferRemainingMs: 0,
coyoteTimeRemainingMs: 0,
jumpHoldRemainingMs: 0,
crouched: false, crouched: false,
wasJumpPressed: false, wasJumpPressed: false,
input: FORWARD_INPUT, input: FORWARD_INPUT,