Refactor interaction prompt logic in runtime-host.ts
This commit is contained in:
@@ -1563,7 +1563,6 @@ export class RuntimeHost {
|
|||||||
if (
|
if (
|
||||||
this.sceneReady &&
|
this.sceneReady &&
|
||||||
this.runtimeScene !== null &&
|
this.runtimeScene !== null &&
|
||||||
this.activeController === this.firstPersonController &&
|
|
||||||
this.currentFirstPersonTelemetry !== null
|
this.currentFirstPersonTelemetry !== null
|
||||||
) {
|
) {
|
||||||
this.interactionSystem.updatePlayerPosition(
|
this.interactionSystem.updatePlayerPosition(
|
||||||
@@ -1571,18 +1570,23 @@ export class RuntimeHost {
|
|||||||
this.runtimeScene,
|
this.runtimeScene,
|
||||||
this.createInteractionDispatcher()
|
this.createInteractionDispatcher()
|
||||||
);
|
);
|
||||||
this.camera.getWorldDirection(this.cameraForward);
|
|
||||||
this.setInteractionPrompt(
|
if (this.activeController === this.firstPersonController) {
|
||||||
this.interactionSystem.resolveClickInteractionPrompt(
|
this.camera.getWorldDirection(this.cameraForward);
|
||||||
this.currentFirstPersonTelemetry.eyePosition,
|
this.setInteractionPrompt(
|
||||||
{
|
this.interactionSystem.resolveClickInteractionPrompt(
|
||||||
x: this.cameraForward.x,
|
this.currentFirstPersonTelemetry.eyePosition,
|
||||||
y: this.cameraForward.y,
|
{
|
||||||
z: this.cameraForward.z
|
x: this.cameraForward.x,
|
||||||
},
|
y: this.cameraForward.y,
|
||||||
this.runtimeScene
|
z: this.cameraForward.z
|
||||||
)
|
},
|
||||||
);
|
this.runtimeScene
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.setInteractionPrompt(null);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setInteractionPrompt(null);
|
this.setInteractionPrompt(null);
|
||||||
}
|
}
|
||||||
@@ -1603,6 +1607,11 @@ export class RuntimeHost {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private applyTeleportPlayerAction(target: RuntimeTeleportTarget) {
|
private applyTeleportPlayerAction(target: RuntimeTeleportTarget) {
|
||||||
|
if (this.activeController === this.thirdPersonController) {
|
||||||
|
this.thirdPersonController.teleportTo(target.position, target.yawDegrees);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.firstPersonController.teleportTo(target.position, target.yawDegrees);
|
this.firstPersonController.teleportTo(target.position, target.yawDegrees);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user