Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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
up vote 2 down vote accepted

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

share|improve this answer

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.

share|improve this answer
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

Not the answer you're looking for? Browse other questions tagged or ask your own question.