I'm currently using Three.JS to create a plane and add some boxes on top of it. I occasionally need to remove all the boxes. To achieve this, I have attempted using the code snippet below:
for (i = 0; i < scene.children.length; i++) {
var object = scene.children[i];
if (object != plane && object != camera) {
scene.remove(object);
}
}
/This code eliminates every object that is not the plane or the camera ;-)/
While it successfully removes some boxes, it fails to delete all of them =( Any suggestions on how to delete all boxes? Regards, José