8

How can I remove mesh from scene in Babylon.js in runtime? Tried to search, didn't find, also tried to view the scene methods in debugger, also can't find.

gman
  • 100,619
  • 31
  • 269
  • 393

2 Answers2

12

You just have to use mesh.dispose();

David Catuhe
  • 1,747
  • 1
  • 10
  • 9
  • 3
    regarding optimization : i reckon it is usefull to set the mesh variable to null after the dispose call (to tell the GC he can collect), right? – Bombinosh Aug 16 '15 at 09:57
1

I guess what you are finding for is this .

This method removes the specific mesh .

scene.removeMesh( mesh name );  

Here is the example https://playground.babylonjs.com/#3UW6W3#2