Raycast missing its target?


My AI is doing raycasts every update to measure how far and which object is at the sides/front of it. It works ok most of the time but it sometimes misses objects that are nearby (but not penetrating) on certain frames.

Is there an issue with raycasts missing moving objects? Is there a way to make my raycasts more reliable?

Thanks much!

Well maybe you could use this Debug function I use a lot when I question if my collision and raycasting (or other cast types) are functioning properly.

I prefer magenta btw :) , but probably need to take a color you will not have in the scene ever ( such as the missing material default colors or skybox colors)

If you can see the ray hit the object and still it doesnt give you the event, update the question and I'll gladly look into it for you!


I used continuous collision detection for the involved colliders instead of discrete and that seems to solve the problem.