javascript - Check if a line and a mesh intersect in three.js -
i have cilinders in scene. when user clicks on specific points, i´m drawing line (three.line) between points. need check if line intersects of cilinders (three.mesh).
this not working
myline.intersectobjects( arrayofcilinders , true)
is possible draw ray on line? in case use
myray.intersectobjects( arrayofcilinders , true)
thanks!
from three.js documentation:
ray(origin, direction)
origin -- vector3 origin of ray.
direction -- vector3 direction of ray.
so if have pointa , pointb clicks of user, can:
(pseudo code)
origin = pointa direction = (pointb-pointa).normalize() myray = three.ray(origin, direction)
you can same three.raycaster()
Comments
Post a Comment