Object3D.remove()
是 three.js
中的一个方法,用于从场景中移除一个物体。
object.remove(child)
child
:要移除的子对象。无返回值。
const scene = new THREE.Scene();
const box = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), new THREE.MeshBasicMaterial({color: 0xff0000}));
scene.add(box); // 将盒子添加到场景中
// 然后通过 remove 方法将盒子从场景中移除
scene.remove(box);
dispose()
方法。