问题
I´m using Three.js, and I created a group of meshes and inside another group
pgrupo= new Array ();
fgrupo=new Array ();
scene.add(pgrupo[0])
pgrupo[0].add(fgrupo[0]):
pgrupo[0].add(fgrupo[1]):
How can I remove a fgroup from the scene?
if I use:
scene.remove(fgrupo[0]);
or
scene.remove(pgrupo[0]);
Nothing happened. How can I delete this things from the scene?
回答1:
Instead of using an Array use the THREE.Object3D and the .add() and .remove() methods.
So
pgrupo = new THREE.Object3D();
fgrupo = = new THREE.Object3D();
scene.add (pgrupo);
Also the method .children gives you an Array with object's children.
来源:https://stackoverflow.com/questions/26303578/remove-a-group-from-scene