Ray can't find a prefab

alt text

My ray can perfectly find a cube in the scene, but when it comes to a prefab (a sphere which jumps on Fire1) it all of the sudden does not see it.
(The ray is green in the scene. In the second case it just shoots forward, not in the flying sphere as it should’ve)

Code is exactly the same in both cases.
What could be the deal?

Thank you.

  1. Check that the prefab isn’t static (top right of the editor)
  2. Check that the collider is actually moving with the sphere mesh, and isn’t being left behind or at the origin.
  3. Check that they’re on the correct layers, or that you’re passing the correct layer mask into the raycast function.
  4. If you’re moving a collider, you should probably have a rigidbody on it, marked as kinematic.
  5. Check your layer collision matrix (in Edit->Project Settings->Physics).