Feature: Add interaction reach property and persistence tests for Player Start entity

This commit is contained in:
2026-04-26 23:05:49 +02:00
parent bdba2de228
commit 63224678c4
2 changed files with 52 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ import {
DEFAULT_PLAYER_START_CAPSULE_RADIUS,
DEFAULT_PLAYER_START_CROUCH_SETTINGS,
DEFAULT_PLAYER_START_EYE_HEIGHT,
DEFAULT_PLAYER_START_INTERACTION_REACH_METERS,
DEFAULT_PLAYER_START_JUMP_SETTINGS,
DEFAULT_PLAYER_START_MOVE_SPEED,
DEFAULT_PLAYER_START_MOVEMENT_CAPABILITIES,
@@ -49,6 +50,7 @@ describe("entity registry defaults", () => {
position: { x: 0, y: 0, z: 0 },
yawDegrees: 0,
navigationMode: "firstPerson",
interactionReachMeters: DEFAULT_PLAYER_START_INTERACTION_REACH_METERS,
movementTemplate: {
kind: "default",
moveSpeed: DEFAULT_PLAYER_START_MOVE_SPEED,

View File

@@ -250,6 +250,56 @@ describe("Player Start inspector", () => {
});
});
it("persists the authored interaction reach for a selected Player Start", async () => {
const playerStart = createPlayerStartEntity({
id: "entity-player-start-interaction-reach",
name: "Interaction Reach"
});
const store = createEditorStore({
initialDocument: {
...createEmptySceneDocument({ name: "Player Start Reach Scene" }),
entities: {
[playerStart.id]: playerStart
}
}
});
render(<App store={store} />);
await waitFor(() => {
expect(viewportHostInstances.length).toBeGreaterThan(0);
});
act(() => {
store.setSelection({
kind: "entities",
ids: [playerStart.id]
});
});
const reachInput = await screen.findByTestId(
"player-start-interaction-reach"
);
expect(reachInput).toHaveValue(1.5);
act(() => {
fireEvent.change(reachInput, {
target: {
value: "3.2"
}
});
fireEvent.blur(reachInput);
});
await waitFor(() => {
expect(store.getState().document.entities[playerStart.id]).toMatchObject({
kind: "playerStart",
interactionReachMeters: 3.2
});
});
});
it("shows authored jump, sprint, and crouch bindings for a selected Player Start", async () => {
const playerStart = createPlayerStartEntity({
id: "entity-player-start-locomotion-bindings",