From a93107989680d3b25252e7788ea416bf11286374 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Fri, 1 May 2026 19:37:50 +0900 Subject: [PATCH] Update lavaLamp.ts --- packages/frontend/src/world/room/objects/lavaLamp.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/world/room/objects/lavaLamp.ts b/packages/frontend/src/world/room/objects/lavaLamp.ts index 0482b9c673..9f411bbc17 100644 --- a/packages/frontend/src/world/room/objects/lavaLamp.ts +++ b/packages/frontend/src/world/room/objects/lavaLamp.ts @@ -59,6 +59,8 @@ export const lavaLamp = defineObject({ applyLightColor(); + let animationObserver: BABYLON.Observer; + return { onInited: () => { const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, cm(11), 0), scene, room?.lightContainer != null); @@ -90,6 +92,10 @@ export const lavaLamp = defineObject({ sphere2.animations = [anim]; scene.beginAnimation(sphere2, 0, 500, true, 0.6); + animationObserver = scene.onAfterAnimationsObservable.add(() => { + room?.sr.updateMesh([sphere, sphere2], false); + }); + const emitter = new BABYLON.TransformNode('emitter', scene); emitter.parent = root; emitter.position = new BABYLON.Vector3(0, cm(10), 0); @@ -123,7 +129,11 @@ export const lavaLamp = defineObject({ case 'lightColor': applyLightColor(); break; } }, + dispose: () => { + if (animationObserver != null) { + scene.onAfterAnimationsObservable.remove(animationObserver); + } + }, }; }, - });