From 84325622526e9142a87f999cab90c784516c487c Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 11 Apr 2026 04:34:26 +0200 Subject: [PATCH] Add scene exit transition request handling in RuntimeHost --- src/runtime-three/runtime-host.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/runtime-three/runtime-host.ts b/src/runtime-three/runtime-host.ts index d5178c26..b3080acc 100644 --- a/src/runtime-three/runtime-host.ts +++ b/src/runtime-three/runtime-host.ts @@ -117,6 +117,12 @@ export interface RuntimeSceneLoadState { message: string | null; } +export interface RuntimeSceneExitTransitionRequest { + sourceExitEntityId: string; + targetSceneId: string; + targetEntryEntityId: string; +} + export class RuntimeHost { private readonly scene = new Scene(); private readonly camera = new PerspectiveCamera(70, 1, 0.05, 1000); @@ -188,6 +194,9 @@ export class RuntimeHost { private sceneLoadStateHandler: | ((state: RuntimeSceneLoadState) => void) | null = null; + private sceneExitHandler: + | ((request: RuntimeSceneExitTransitionRequest) => void) + | null = null; private currentRuntimeMessage: string | null = null; private currentFirstPersonTelemetry: FirstPersonTelemetry | null = null; private currentInteractionPrompt: RuntimeInteractionPrompt | null = null; @@ -422,6 +431,14 @@ export class RuntimeHost { } } + setSceneExitHandler( + handler: + | ((request: RuntimeSceneExitTransitionRequest) => void) + | null + ) { + this.sceneExitHandler = handler; + } + dispose() { if (this.animationFrame !== 0) { cancelAnimationFrame(this.animationFrame); @@ -1642,6 +1659,13 @@ export class RuntimeHost { teleportPlayer: (target) => { this.applyTeleportPlayerAction(target); }, + activateSceneExit: (sceneExit) => { + this.sceneExitHandler?.({ + sourceExitEntityId: sceneExit.entityId, + targetSceneId: sceneExit.targetSceneId, + targetEntryEntityId: sceneExit.targetEntryEntityId + }); + }, toggleBrushVisibility: (brushId, visible) => { this.applyToggleBrushVisibilityAction(brushId, visible); },