Simplify interaction prompt display and handling in various components
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user