- Home /
Raycast ScreenPointToRay Problem
I have a strange problem. I've used Raycasting and screenPointToRay countless times and have never run into this. The raycast only detects objects when the camera is rotated to 0 or less in the x axis. The scene I have requires the camera to be rotated to 12 in the x axis.
For some reason the raycast can't detect anything. If I rotate the camera to 0 in the x axis it works fine.
Any ideas?
Could you post some of your code regarding the setup of the ray and raycast?
You might have done this already but I often find something simple like an object blocking the path, see if any hit returns at all with print(hit.gameObject.transform.name);
Answer by Cor · Jan 15, 2011 at 12:50 AM
used the print(hit.transform.name); and it turns out it was colliding with an empty gameObject that had a box collider on it. Kinda embarrassed. Thanks though for the help in solving the problem. It's a handy trick to keep in mind.