How Can I Destroy Threejs Scene?
I created a Threejs Scene, adding camera, lights and various objects. The question is simple: how can I destroy scene? Removing from scene all components? I need to destroy scene b
Solution 1:
I used this:
cancelAnimationFrame(this.id);// Stop the animationthis.renderer.domElement.addEventListener('dblclick', null, false); //remove listener to renderthis.scene = null;
this.projector = null;
this.camera = null;
this.controls = null;
empty(this.modelContainer);
The method empty is a substitute to jQuery empty, you can use it:
function empty(elem) {
while (elem.lastChild) elem.removeChild(elem.lastChild);
}
Post a Comment for "How Can I Destroy Threejs Scene?"