From 20acbbecaafd1b79e42cb13cdffe610075ca7b7c Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Sun, 25 Jun 2023 18:18:33 +0300 Subject: [PATCH] dispose physics on remove --- src/world/physics.service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/world/physics.service.ts b/src/world/physics.service.ts index 73d6300..feb6e9b 100644 --- a/src/world/physics.service.ts +++ b/src/world/physics.service.ts @@ -88,6 +88,10 @@ export class PhysicsService { root.traverse((object) => { if (trackedObjects.some((item) => item.uuid === object.uuid)) { physicsLeaveUUIDs.push(object.uuid); + + if ((object as PhysicsObject).dispose) { + (object as PhysicsObject).dispose(); + } } });