简体   繁体   中英

Raycasting to faces using Three.js

By using an octree I get an array of faces that is close to an object. How can I ray cast to them. I can only find how to ray cast to a mesh, line or point?

If you're using threeoctree , you do the following:

// 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 );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM