有没有一种方法可以按照光线添加到场景中的顺序检查光线是否与物体相交
intersects = point.intersectObjects( scene.children );
the intersects property always returns objects in order of proximity.
however, you can give objects a name when adding them to the scene. when intersects returns them you can then order them by name.
example:
when adding to the scene set the name of an object as an int from a counter variable.
after you get the intersect array you can use array.sort() on it.
note, this only works if the objects are in their own group/object3d. since meshes cant have names.
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.