Yet again I am having problems with collision detection in my game.
Here’s the situation. I basically have a snake as a character, and the wiggling is done with a chain of bones. I’ve been trying to add collision for the snake with a SphereCast on each bone/link. This partially works, however the problem is that it has the same limitation as a regular raycast in that it cannot detect backfacing sides. Apparently the fact it’s a sphere doesn’t matter; it’s still only detecting along one line, it’s just a thicker line. So if an object passes through it from certain positions, it won’t detect any collision at all because the polygon is backfacing.
I also tried using a CapsuleCast, but it has the same problem, although handles it a lot better due to casting in two directions rather than one. But it still misses a lot of collisions.
What I really want is just something like the CheckCapsule command, which has no problem detecting every collision, however it’s completely useless for anything more than saying “Yep, you’re touching something”, but I need it to return the specific GameObject itself. I don’t need any information about the specifics of the collision beyond the GameObject.
Is there any foolproof way of detecting a collision within a volume through code that will not miss collisions?
(And before anyone asks, I can’t do this with regular colliders, because none of my movement or collision is done through rigidbodies. No physics at all.)