I want to get 3d position based on cursor position. I want to implement this with casting rays, but I don't understand a few stuff in the documentation.
I read that I could use the following code:
var dropPlane = Plane(Vector3(0, 0, 1), ???planeSize???)
var position3D = dropPlane.intersects_ray(
camera.project_ray_origin(mousePos2D),
camera.project_ray_normal(mousePos2D))
This however is not working for me, so I wanted to understand the method(s).
From documentation:
"Vector3 intersects_ray( Vector3 from, Vector3 dir )
Returns the intersection point of a ray consisting of the position "from" and the direction normal "dir" with this plane. If no intersection is found null is returned."
What does direction normal mean here? I know what normal vector is, I know what direction is, but don't know direction normal.
I also would like some explanation on the other two methods:
camera.project_ray_origin(mousePos2D)
camera.project_ray_normal(mousePos2D)
Thank for your help!