Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 ..i mean they overlap after collision... i tried changing the directions after collisions and it works well..bt 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...

http://img21.imageshack.us/i/18956982.jpg/

any help would be much appreciated. thanks in advance

share|improve this question
2  
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
add comment

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.

2 Answers

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
add comment

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
add comment

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