If I were to instantiate objects using the code below:
const group = new THREE.Object3D();
for (let i = 0; i < 10; i++) {
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshNormalMaterial();
const mesh = new THREE.Mesh(geometry, material);
group.add(mesh);
}
scene.add(group);
What would be the method for removing those objects from the group?
I attempted this approach...
for (let i = group.children.length - 1; i >= 0; i--) {
scene.remove(group.children[i]);
}
...yet it returns 'undefined'. What could be causing this issue?