I'm looking for ideas on how to simulate accurate (as possible) deflection for a projectile moving with a certain velocity in a tile-based 2D game.
The player is able to shoot a projectile to any direction. Right now, I'm casting a ray from the top, bottom, left and right sides of the BoxCollider2D of the projectile and - for example, if the top ray hits a wall - I use Vector2.Reflect to set the new velocity for the projectile (see the upper part of the image).
The problem I'm trying to solve (see the bottom part of the image) happens when the projectile approaches the corner of a BoxCollider2D. That particular situation causes unwanted behavior and I'm thinking of adding 4 additional raycasts (top-left, top-right etc.) for the projectile to check the diagonal collisions (trying it soon).
I'm fairly new to dealing with 2D collision - so I'm interested in hearing about your solutions or ideas, especially if you have dealt with 2D collision / deflection before. Any alternative or more simple solutions are welcome! Maybe this can be done much easier with CircleColliders?