# doubts in circle circle collisions [duplicate]

Possible Duplicate:
two balls stick together in a pool game?

I have problems in circle circle collisions in a pool ball game..

The game has problems like the circles (or balls) stick together: they overlap after collision. I tried changing the directions after collisions and it works well, but when I arrange the balls real close and then the striker ball is shot at high velocity towards any of the balls, the balls start overlapping again, and also the striker ball slides over the hit balls.

What could be the reason for this and how could I fix it?

-

## marked as duplicate by Tetrad♦Aug 10 '10 at 15:53

How many times are you going to ask the same question without providing any specifics that might help us help you? – drxzcl Aug 10 '10 at 11:32
Vishnu Ajit: How do you resolve collisions? If ball A collides with ball B and either balls get moved you have to make sure to resolve any collisions (and detect them) that the balls might cause from moving after the collision... if that makes sense. – Simon Aug 10 '10 at 12:54

Honestly, I would just use a physics library. It saves a lot of trouble in the long run, especially with respect to collision response.

-

Did you remember to abort moving the ball if you predict a collision when moving to the new location?

What you might be doing is that you're actually moving the ball first, then checking if it has collided.

If you check for collision, then move the ball you should avoid these overlapping cases.

Assuming you're checking for collision often enough.

-
It does sound like he moved first. Then, while inter-penetrated past mid-point, he calculated a new velocity (in roughly an opposite direction) which did not have the speed to separate them by the next frame, which again reversed direction, which didn't make it out... etc...etc... balls stick together. @Vish: If you move first, you must remove penetration before calculating new velocity. Better yet, google, & implement quadratic equation which solves exact point of contact, then calculate new velocity from there. One of these threads should not have been closed... it is a common noob problem. – Steve H Sep 1 '10 at 14:52