Ray ray = camera.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, Mathf.Infinity, mask) hit.transform != null)
{
//hit something
}
Or do a search here on the forum. This question (more or less) has been asked a few times.
by using this code:
var hit: RaycastHit;
Physics.Raycast(ray, hit);
I can then use the hit variable’s point, to get the position of where the raycast meets the world.