使用Three.js对面部进行光线投射

时间:2017-07-03 15:49:23

标签: javascript three.js collision-detection raycasting

通过使用八叉树,我得到一个靠近物体的面数组。我怎样才能射线投射到他们身上。我只能找到如何射线投射到网格,线或点?

1 个答案:

答案 0 :(得分:1)

如果您使用的是threeoctree,请执行以下操作:

// get the faces using octree search
var octreeObjects = this.octree.search( raycaster.ray.origin, raycaster.ray.far, true, raycaster.ray.direction );
// find the intersections only with the faces you found
var intersections = raycaster.intersectOctreeObjects( octreeObjects );