I’m following a simple tutorial, but I can’t seem to get the ray to hit an object.
Debug.Log( "Mouse Position: " + Input.mousePosition );
Ray ray = Camera.main.ScreenPointToRay( Input.mousePosition );
if (Physics.Raycast(ray))
{
Debug.Log("Hit something!");
}
I do get the mouse position back, however, I’m not hitting any object even though there clearly are objects in the game window.
Is there something that I’m doing wrong or I should check for?