Original Post
Hi Iam trying to make some balls bounce in 2D. My code goes something like this: if the balls intersect: Normal = -atan2(y, x); // y and x is simply the distance between the balls ball1.dir = ball1.dir - (Normal - ball1.dir) * 2; ball2.dir = ball2.dir - (Normal - ball2.dir) * 2; My questions is: This works if they collide when they move towards each other, but not (for example) if they are moving in same direction but the other ball is faster how can I get rid of that. Does this kind of code works for many balls what about three collide at the same time and such stuff. Some information would be nice! Thanks in Advance