Simplify interaction prompt display and handling in various components

This commit is contained in:
2026-04-11 11:39:33 +02:00
parent 9026a34c72
commit 43e9e7baa0
7 changed files with 212 additions and 107 deletions

View File

@@ -346,6 +346,11 @@ describe("RuntimeInteractionSystem", () => {
y: 1.6,
z: 0
},
{
x: 0,
y: 1.6,
z: 0
},
{
x: 0,
y: 0,
@@ -362,6 +367,11 @@ describe("RuntimeInteractionSystem", () => {
expect(
interactionSystem.resolveClickInteractionPrompt(
{
x: 0,
y: 1.6,
z: 0
},
{
x: 0,
y: 1.6,
@@ -377,6 +387,46 @@ describe("RuntimeInteractionSystem", () => {
).toBeNull();
});
it("uses the player eye for interaction range while aiming with a third-person camera ray", () => {
const runtimeScene = createRuntimeSceneFixture();
runtimeScene.interactionLinks = [
createTeleportPlayerInteractionLink({
id: "link-click-teleport",
sourceEntityId: "entity-interactable-console",
trigger: "click",
targetEntityId: "entity-teleport-main"
})
];
const interactionSystem = new RuntimeInteractionSystem();
expect(
interactionSystem.resolveClickInteractionPrompt(
{
x: 0,
y: 1.6,
z: 0
},
{
x: 0,
y: 1.6,
z: -2
},
{
x: 0,
y: 0,
z: 1
},
runtimeScene
)
).toEqual({
sourceEntityId: "entity-interactable-console",
prompt: "Use Console",
distance: expect.any(Number),
range: 2
});
});
it("dispatches click actions for the targeted Interactable", () => {
const runtimeScene = createRuntimeSceneFixture();
runtimeScene.interactionLinks = [
@@ -483,6 +533,11 @@ describe("RuntimeInteractionSystem", () => {
y: 1.6,
z: 0
},
{
x: 0,
y: 1.6,
z: 0
},
{
x: 0,
y: 0,