The first step is to get ball objects to properly bounce off of the walls.
Then we added a calculation of the intersection of the relative path of one ball with respect to the other with a circle equal to the sum of the two radii. We made the animation "pause" momentarily at the intersection point.
Finally we added the equations for the changed velocity after impact. There are still some obvious problems - due to a somewhat subtle bug (not yet fixed)
The equations for collisions between elastic particles can be modified to use the COR, thus becoming applicable to both elastic and partially inelastic collisions as well. Note that these equations give the velocity change along the line of centers. The transverse velocities are unchanged.


where
Reference: Coefficient of Restitution, Wikipedia article
Because there were bugs in our original code for transforming to and from the "line of intersection" coodinate system, we tested just the part where we transformed coordinates - but without actually changing velocity. Ideally, there should be no change (or interaction) between the balls now.
Maintained by John Loomis, last updated 5 April 2008