Hey codemonkey! I saw the other similar questions on this topic but never saw any example code. Right now, i have the problem of when i click on empty space, the player still moves to another position. Is this what you were saying? how would i use it properly?
public static bool TryGetPosition(out Vector3 position)
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
Physics.Raycast(ray, out RaycastHit raycastHit, float.MaxValue, instance.mousePlaneLayerMask);
position = raycastHit.point;
return Physics.Raycast(ray);
}
thanks!