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

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -