Given a sweep test for a ray, how do we check collisions after the 1st collision has been detected, and the ray has been deflected.
Physics system steps are:
- Update velocities (gravity, etc)
- Resolve collisions
- The ray will intersect the floor, and will be moved back at the penetration amount.
- The new velocity is calculated as a reflection
- Update positions
- The ray is now on the wrong side of the wall
This all happens in 1 frame
If the orange ray hits the floor just before the wall, the new velocity will tunnel the ray through the wall within one frame. The naive way to fix this would be to after each collision check all the bodies again with the new velocity, but this can take multiple iterations if the ray bounces around in a corner. There is no way of knowing how many times the ray will need to be processed.
What would be a good way to fix this issue?