I have a task where I have to create a Ray at an arbitrary origin with a direction to find the intersection with the terrain below and also find the intersection point there.
To explain in simplest possible terms, I created this example on jsfiddle.
I have a vector with the origin at the top of the BoxGeometry going towards the negative z-axis here. Although the intersections are good (i.e the ray intersects with every plane geometry below), the distance to these plane meshes and their corresponding intersection points do not seem right.
Seems like it returns a value approximately equal to (0,0,0) as a point of intersection for every plane mesh above. Is there something to do with the world matrix here?
What am I doing wrong here? Any help would be appreciated.