MeshBVH.closestPointToGeometry(geometry) 是 Three.js 中 MeshBVH 类的一个方法。它接收一个几何体 geometry 作为参数,返回一个 THREE.Vector3 类型的向量,表示该几何体到 MeshBVH 树中最近的点在空间中的坐标位置。
geometry: Geometry 或 BufferGeometry 类型的几何体。
THREE.Vector3 类型的向量,表示该几何体到 MeshBVH 树中最近的点在空间中的坐标位置。
const geometry = new THREE.BoxGeometry();
const bvh = new THREE.MeshBVH(geometry);
const otherGeometry = new THREE.SphereGeometry(1);
const closestPoint = bvh.closestPointToGeometry(otherGeometry);
console.log(closestPoint);
MeshBVH.closestPointToGeometry() 方法只接受 Geometry 或 BufferGeometry 类型的几何体作为参数。