diff --git a/plccpu9dx0.js b/plccpu9dx0.js index 175063f..e849323 100644 --- a/plccpu9dx0.js +++ b/plccpu9dx0.js @@ -268,10 +268,10 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { } - this.kill = function(enemy) { - /** - * We only remove the things we cloned - */ + this.kill = function(enemy) { + /** + * We only remove the things we cloned + */ GameLib.Event.Emit( GameLib.Event.REMOVE_COMPONENT, { @@ -286,6 +286,12 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { } ); + /** + * Also dispose of the THREE.js objects + */ + enemy.mesh.instance.geometry.dispose(); + enemy.mesh.instance.material.dispose(); + if (enemy.smokeParticleEngine) { enemy.smokeParticleEngine.remove(); enemy.smokeParticleEngine = null;