Add scene readiness check in RuntimeHost

This commit is contained in:
2026-04-11 04:15:33 +02:00
parent 5e64f4db1e
commit e4ad280ea5

View File

@@ -1287,7 +1287,12 @@ export class RuntimeHost {
mixer.update(dt); mixer.update(dt);
} }
if (this.runtimeScene !== null && this.activeController === this.firstPersonController && this.currentFirstPersonTelemetry !== null) { if (
this.sceneReady &&
this.runtimeScene !== null &&
this.activeController === this.firstPersonController &&
this.currentFirstPersonTelemetry !== null
) {
this.interactionSystem.updatePlayerPosition(this.currentFirstPersonTelemetry.feetPosition, this.runtimeScene, this.createInteractionDispatcher()); this.interactionSystem.updatePlayerPosition(this.currentFirstPersonTelemetry.feetPosition, this.runtimeScene, this.createInteractionDispatcher());
this.camera.getWorldDirection(this.cameraForward); this.camera.getWorldDirection(this.cameraForward);
this.setInteractionPrompt( this.setInteractionPrompt(
@@ -1407,16 +1412,24 @@ export class RuntimeHost {
} }
private handleRuntimeClick = () => { private handleRuntimeClick = () => {
this.audioSystem.handleUserGesture(); if (
!this.sceneReady ||
if (this.runtimeScene === null || this.activeController !== this.firstPersonController || this.currentInteractionPrompt === null) { this.runtimeScene === null ||
this.activeController !== this.firstPersonController ||
this.currentInteractionPrompt === null
) {
return; return;
} }
this.audioSystem.handleUserGesture();
this.interactionSystem.dispatchClickInteraction(this.currentInteractionPrompt.sourceEntityId, this.runtimeScene, this.createInteractionDispatcher()); this.interactionSystem.dispatchClickInteraction(this.currentInteractionPrompt.sourceEntityId, this.runtimeScene, this.createInteractionDispatcher());
}; };
private handleRuntimePointerDown = () => { private handleRuntimePointerDown = () => {
if (!this.sceneReady) {
return;
}
this.audioSystem.handleUserGesture(); this.audioSystem.handleUserGesture();
}; };
} }