diff --git a/src/viewport-three/viewport-host.ts b/src/viewport-three/viewport-host.ts index 7c9115c2..86eb71ca 100644 --- a/src/viewport-three/viewport-host.ts +++ b/src/viewport-three/viewport-host.ts @@ -1017,6 +1017,7 @@ export class ViewportHost { ) { this.currentSimulationScene = runtimeScene; this.currentSimulationClock = clock; + this.simulationInteractableEnabledById.clear(); this.applyWorld(); if (this.currentDocument === null) { @@ -1029,6 +1030,29 @@ export class ViewportHost { this.rebuildModelInstances(this.currentDocument, this.currentSelection); } + updateSimulationFrame( + runtimeScene: RuntimeSceneDefinition | null, + clock: RuntimeClockState | null + ) { + if (this.currentSimulationScene !== runtimeScene) { + this.updateSimulation(runtimeScene, clock); + return; + } + + this.currentSimulationClock = clock; + this.applyWorld(); + + if (this.currentDocument === null || runtimeScene === null) { + return; + } + + this.syncSimulationLocalLights(runtimeScene); + this.syncSimulationLightVolumes(runtimeScene); + this.syncSimulationNpcs(runtimeScene); + this.syncSimulationInteractables(runtimeScene); + this.syncSimulationModelInstances(runtimeScene); + } + updateSelection(selection: EditorSelection, activeSelectionId: string | null) { const previousSelection = this.currentSelection; const selectionChanged = !areEditorSelectionsEqual(