Raycast hit to world coordinates?

How do I get world coordinates from a raycast hit?

Starting from the example code for raycast, hit.point gives you the coordinates.

yes but this line of code:

Vector3 hitCoordinates = hit;

gives this error:

Cannot implicitly convert type ‘UnityEngine.RaycastHit’ to ‘UnityEngine.Vector3’…

and in the docs, it says that hit is a Vector3…

i understand that it has something to do with conversion from the camera to world coordinates but all the example i have something to do with mouse position… i do knot know why, i just need the coordinates of the hit…

hit**.point**

1 Like

thank you
:slight_smile: