I am programming a game in the spirit of Wolfenstein 3D (2D grid map, 1 cell = 1 cube) and I wanted to implement shootings. I didn't want the shootings to happen in one frame so, I wanted to see the beams flying everywhere.
So this gets a bit complicated for me to test for impacts. To be fair, I'm not really sure how I'm supposed
This is how I used to do it : I took the position of the beam and checked on the map to see if there is a wall at said position. It works great when the beam is moving very slowly. But when they go extremely fast, naturally, as you would expect, they clip through walls.
Here you can have an idea of what I'm looking for. 2D grid with white cells being air and grey cells being walls. Player is green, beam is red and dotted lines represent the beam on next frames. And orange is the collision
So I'm not exactly sure when and what to test for collisions here, as well as how to find the impact's position. What would be the most optimised way to test for collisions ?