From e4ad280ea53d48a3e9eaf2d864359ef0fff5b9e8 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 11 Apr 2026 04:15:33 +0200 Subject: [PATCH] Add scene readiness check in RuntimeHost --- src/runtime-three/runtime-host.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/runtime-three/runtime-host.ts b/src/runtime-three/runtime-host.ts index ca28471c..83cc0d6d 100644 --- a/src/runtime-three/runtime-host.ts +++ b/src/runtime-three/runtime-host.ts @@ -1287,7 +1287,12 @@ export class RuntimeHost { 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.camera.getWorldDirection(this.cameraForward); this.setInteractionPrompt( @@ -1407,16 +1412,24 @@ export class RuntimeHost { } private handleRuntimeClick = () => { - this.audioSystem.handleUserGesture(); - - if (this.runtimeScene === null || this.activeController !== this.firstPersonController || this.currentInteractionPrompt === null) { + if ( + !this.sceneReady || + this.runtimeScene === null || + this.activeController !== this.firstPersonController || + this.currentInteractionPrompt === null + ) { return; } + this.audioSystem.handleUserGesture(); this.interactionSystem.dispatchClickInteraction(this.currentInteractionPrompt.sourceEntityId, this.runtimeScene, this.createInteractionDispatcher()); }; private handleRuntimePointerDown = () => { + if (!this.sceneReady) { + return; + } + this.audioSystem.handleUserGesture(); }; }