I am learning basic collision detection.

Using posteriori (discrete) method for collision detection. Assume the simplest case of 2 circles in 2D, same mass, same size, and assume elastic collision and assume they are moving on the x-axis and are moving towards each other’s.

Now advanced the simulation one time step.

Assume now the circles are now in collision where one circle has entered another. This is found by checking that the distance between their centers is smaller than 2*r where r is the radius).

Now the speeds are adjusted according to the standard equation and the simulation is advanced one time step and the positions are adjusted. For this case, the speeds will flip directions and the circles will start moving away from each other’s.

The problem is that if the simulation time step is too small or the objects are moving too slow, it is possible that the 2 circles will remain in collision by the next step because they have not moved out of each other’s completely yet.

Therefore, in the next time step, the circles are found again to be in collision, and the speeds are adjusted again, but now they will flip backwards, and hence the circles will begin to move back into each other’s.

On the next time step, collision is detected again, and the speeds adjusted, and circles will now move away from each other’s.

This process repeats, and the circles will remain in collision unable to completely leave each other’s.

I am sure this is a known issue with the posteriori method. What is the best way to resolve this scenario?

## 2 Replies - 1140 Views - Last Post: 24 September 2012 - 03:46 PM

### #1

# How to get out of collision when using posteriori (discrete) method

Posted 24 September 2012 - 09:47 AM

##
**Replies To:** How to get out of collision when using posteriori (discrete) method

### #2

## Re: How to get out of collision when using posteriori (discrete) method

Posted 24 September 2012 - 09:50 AM

This shouldn't happen. If the step size is n, then there is an overlap between the two circles of diameter n. On the next step, they should move n distance away from each other. Since you are dealing with one dimension, there is no issue.

### #3

## Re: How to get out of collision when using posteriori (discrete) method

Posted 24 September 2012 - 03:46 PM

macosxnerd101, on 24 September 2012 - 09:50 AM, said:

This shouldn't happen. If the step size is n, then there is an overlap between the two circles of diameter n. On the next step, they should move n distance away from each other. Since you are dealing with one dimension, there is no issue.

This does happen. I was only giving a simple example just for illustration. In a general case, with many particles moving in all directions, this suitation can develope. Here is a simple example. Imagine 4 balls in the x axis like this, where ball A and D are moving as shown, and ball B and C are not moving. Now ball D will knock ball C to the left and ball A will knock ball B to the right:

-> <-

AB CD

In the next time step, ball B and C will move towards each others and they can enter into each others may be becuase the time step is too large

-><-

B C

Now in the next time step, B and C will have speeds in the other directions,

<- ->

B C

but the new position will be such that they are still a little bit inside each others. So they are still in collision. So in next step after that they will move back into each other

-><-

B C

and so on.

In other words, the 2 balls remain in collision for more than one time step. Once the 2 balls remain in collision for more than one step, it is hard for them to separate unless a 3rd ball comes in to break them apart.

Page 1 of 1