ExtremelySeriousChicken ExtremelySeriousChicken - 1 year ago 379
Javascript Question

How do I clear THREE.JS Scene

I am trying to find ways of clearing all the objects in a scene without destroying the scene itself. I know that naming the object is one way and then when we want to delete the object, we just "get" it by its name. However, I want to find a quick way to clear a scene of all the objects in it, regardless of their names. Is there a easy way to do it? Thanks!

Answer Source

You can traverse the child objects of the scene and remove them one by one. for loop works aswell.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download