I’m looking for a way to get a mouse click location to a 3D coordinate.
I can get the X and Y easily but the Z has stumped what i’d like to do is a raycast out and use the mesh behind the click to calculate the Z position.
So on mouse click record X and Y location of mouse and raycast to the mesh behind the mouse click where it intersects is where I want my 3D coordinates.
Unfortunately I don’t know how to do this so any help would be great!
Thanks
Edit: I’m not sure if raycast is the best way to do this, if there is another way to get the 3d mouse position based on the polygon underneath the mouse click that would be great, some more information is that the view can be changed and works like a fly camera.