copy
方法用于复制一个 BoundingSphere
对象到一个新的对象上。
newSphere = boundingSphere.copy([newBoundingSphere]);
newBoundingSphere
:可选。要将 BoundingSphere
复制到的新对象。如果未提供,则会创建一个新的 BoundingSphere
对象。BoundingSphere
对象。const sphere1 = new THREE.Sphere(new THREE.Vector3(0, 0, 0), 1);
const sphere2 = new THREE.Sphere(new THREE.Vector3(2, 2, 2), 2);
const copiedSphere = sphere1.copy(sphere2); // 复制 sphere2 到新的对象
console.log(copiedSphere.center); // Vector3 { x: 2, y: 2, z: 2 }
console.log(copiedSphere.radius); // 2
newBoundingSphere
参数,则会创建一个新的 BoundingSphere
对象。否则,将使用提供的对象来存储复制的 BoundingSphere
。BoundingSphere
复制到现有对象上时,请确保这个对象没有其他重要的数据,因为 copy
方法将覆盖这个对象所有的属性值。