math & physics
This question has been spooking around in my head for way too long...
- You're coding a program in which 10 circles move around on the screen in realtime, all with a different velocity, that can change at certain times due to physics-calculations.
- The calculations can only be calculated on every frame
- Each frame, you have to make sure the circles who "collide"/"have collided during the time between this frame and the last" with eachother will 'bounce off' by using physics-calculations
- During the time between frame x and frame x+1, three circles will collide with eachother. However, during frame x none of the circles touches the other. In frame x+1, the same thing applies (none collides) I will try to better illustrate this with an image with my epic paint skills:
What are good ways to keep track of collision like this, so that a collision wouldn't get skipped due to some (unexpected) large delay in time between two frames?
This is a well known problem with some good solutions, like Swept Circles for 2D and Swept Spheres for 3D collision detection and response.
Example tutorial: http://www.t3hprogrammer.com/research/circle-circle-collision-tutorial
As said above, it is a common problem named: "tunneling", "bullet through paper". Maybe these names gives you help finding the solution (google these, a lots of examples, tutorials for solving this).
Btw, I didn't mean to restrict the question to circles, was just to give a simple example.