I have a rather strange issue. In the attached screenshot you will see four raycasts. One from 3 objects, which are trying to determine what region they belong to, and the fourth, hitting the colored region is from mouse input. The mouse input one succeeds, which changes the region color to blue. The rest of the raycasts fail, but I don’t understand why. The spheres are set to ignore raycasts, so the raycast is going through them, hitting the map, and then failing.
What would be causing this behavior?
Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
Ray ray = Camera.main.ScreenPointToRay(pos);
RaycastHit hit;
if(!Physics.Raycast(ray, out hit));
{
Debug.Log("Raycast failed");
Debug.DrawLine(ray.origin, ray.origin + Vector3.forward * 100f, Color.green, 10000);
return;
}
// Do stuff here
[27980-screen+shot+2014-06-19+at+11.27.06+am.png|27980]