2D Ball Collisions16 May 2014
A demo of 2D collision between moving balls.
The generation of the balls is done by assigning random positions, no checking is done
for startin position overlap. Usually the system sorts itself out after a few frames, but
a persistent bug can be fixed by reloading the page and hence the demo.
The resultant velocity between each ball can be calculated using the following formula
You can produce the same result using a vector solution, but I went for the former.
Checking for a circle-circle collisions is easy enough, if the distance between the center points is less than the sum of the radii there is an overlap.