+1 vote

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!

in Engine by (148 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.