- Home /
Strange and questionable behavior with OverlapSphere and Casting
I built a visualizer for making spells, attacks, guns, etc or whatever I need for my games to get feedback about the damage. The blue squares are "enemies", the white lines are walls. Red means they are open to attack. Green means they are flagged as being behind a wall. White is the point of the area explosion. Camera is top downish.
Script is just a basic overlapsphere with a layermask for enemies only. The next check is done on a layermask from the enemy to the bomb that only checks walls and flags the enemies,, because in reverse hasn't seemed to work.
As I found out Raycasting is a bad solution for wall checks in this manner The results are really crazy. I need to update my post from last because I found a better way which is...
Line Casting! Almost perfect results and did everything I wanted this weapon to do with LOS, which is hit walls but explode. but not damage anything on the other side or anything that was in cover of the doorway. So I was pretty happy about this until...
Right here I found a repeatable issue. In picture A) the checks run perfect, but in B there is that one node on the upper left that gets hit by the weapon. You'll notice too in example 3 on the first picture, what I thought was failure meant it actually worked right but still had strange results. You can repeat and fix this issue by moving that enemy literally 0.03 degrees in any direction. It will also sometimes reproduce this on the same column but at the bottom of the radius. If you shoot the gun from the left side of the wall, it will do the same thing but on the right side as it's reflective of the issue.
So yeahhhhhhhhh. I'm at a loss here and if anything this isn't a huge problem. This weapon now has a 0.1% chance to cause PTSD in the enemy when they hear the explosion resulting in them taking damage anyway. I think this one of those "every game has a bug" things because the circumstances in which this can possibly happen would actually be slim in the game... still though. That would bother anyone that saw it right?
Your answer
Follow this Question
Related Questions
reverb zones with spheres and raycasts 0 Answers
Linecast questions. 1 Answer
Help with Raycast C# 0 Answers
How expensive is Overlapsphere than a few raycastings? 0 Answers