Calculating collisions in realtime - dealing with a delay in time

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Dec 20, 2011 at 00:08

This question has been spooking around in my head for way too long…

Suppose:

  • 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:

http://imageshack.us…ionproblem.jpg/

The question:

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?

3 Replies

Please log in or register to post a reply.

17ba6d8b7ba3b6d82970a7bbba71a6de
0
vrnunes 102 Dec 20, 2011 at 00:34

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

A1b52ffd884d07e67d76399b59b6cf29
0
jari 101 Dec 20, 2011 at 10:48

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). :)

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Dec 20, 2011 at 16:33

Btw, I didn’t mean to restrict the question to circles, was just to give a simple example.