For some reason my raycast isn’t working. I was wondering if someone could help me. Here is my code:
void Update () {
if (Input.GetMouseButtonDown(0))
{
RaycastHit hit;
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Ray ray = Camera.main.ScreenPointToRay(mousePos);
if (Physics.Raycast(ray, out hit, Mathf.Infinity, 0)) {
Debug.Log("Works");
}
}
}
For some reason it isn’t logging the message.