The following is a simulation for elastic collision which means that
1. the momentum is conserved: m_1\vec{V_1}+m_2\vec{V_2}=m_1\vec{V'_1}+m_2 \vec{V'_2} where m_1,m_2 are mass for each object, \vec{V_1},\vec{V_2} are velocity vectors before collision,\vec{V'_1},\vec{V'_2} are velocity vectors after collision.
2. the total energy is conserved: \frac{1}{2}m_1\vec{V_1}^2+\frac{1}{2}m_2\vec{V_2}^2=\frac{1}{2}m_1\vec{V'_1}^2+\frac{1}{2}m_2\vec{V'_2}^2
For collision in 2D, there are four unknow, however, there are only three equations. Because the contact point is missing in the above equations.
To solve the above problem, we can break 2D collision problem into two 1D collision problem once we know the contact point (when collision happened).
We use x-y coordinate to describe the position of those two balls before and after the collision.
At the time when two balls just in contact with each other, we can choose a new coordinate system:
1. direction from center of mass of m_1 to center of mass of m_2: The interaction forces bwteen those two balls during collision is limited to this direction.  It become a [url=]1D collision problem[/url] in this direction.
2. direction which is perpendicular to the above direction: Assume there is no friction between those two balls, no rotation effect to be considered, then the velocity component for those two balls in this direction will not be changed when collision happened (Because the interaction force dose not have component in this direction).

VIEW or DOWNLOAD ejs xml source
then click to translate strings for selected locale.

Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop.

This simulation shows the physics of two ball collide in 2D (without any rotation motion).

    Physics processes:
  1. when two ball meets, the program shows two components of the velocity for each ball (along the line connect two ball and perpendicular to it)

  2. Interaction (force) between balls is along the line connect two balls

  3. Velocitys perpendicular to connection line are not changed (No force/interaction in that direction)

  4. The rest of the problem is similar to 1D collision problem for ball with velocity along the line
  6. Because this is a 2D simulation, so the radius is proportional to the square root of the mass to keep the same density (for those balls).

You need to understand conservation of momentum and conservation of energy.
The velocity of two objecs after collision (V[sub]1[/sub]',V[sub]2[/sub]')can be calculated from velocity before collisions (V[sub]1[/sub],V[sub]2[/sub]) and mass of two objects (m[sub]1[/sub],m[sub]2[/sub]).

V[sub]1[/sub]'= (m[sub]1[/sub]-m[sub]2[/sub])*V[sub]1[/sub]/(m[sub]1[/sub]+m[sub]2[/sub]) + 2*m[sub]2[/sub]*V[sub]2[/sub]/(m[sub]1[/sub]+m[sub]2[/sub])= (m[sub]1[/sub]V[sub]1[/sub]+m[sub]2[/sub]V[sub]2[/sub])/(m[sub]1[/sub]+m[sub]2[/sub])+(V[sub]2[/sub]-V[sub]1[/sub])*m[sub]2[/sub]/(m[sub]1[/sub]+m[sub]2[/sub])=V[sub]cm[/sub]+(V[sub]2[/sub]-V[sub]1[/sub])*m[sub]2[/sub]/(m[sub]1[/sub]+m[sub]2[/sub]);


Where V[sub]cm[/sub]=(m[sub]1[/sub]V[sub]1[/sub]+m[sub]2[/sub]V[sub]2[/sub])/(m[sub]1[/sub]+m[sub]2[/sub]);
Before the collision, the velocity of m[sub]1[/sub] relative to V[sub]cm[/sub] is
compare it with the second term in V[sub]1[/sub]'

If m[sub]1[/sub]=m[sub]2[/sub]  then V[sub]1[/sub]'=V[sub]2[/sub], V[sub]2[/sub]'-V[sub]1[/sub] ;
it means that both particles just exchange velocity.
If m[sub]1[/sub]>> m[sub]2[/sub] then V[sub]1[/sub]' ? V[sub]1[/sub] ; V[sub]2[/sub]'? 2V[sub]1[/sub]+V[sub]2[/sub];
i.e.  [b]If a heavy car hit you with velocity V[sub]1[/sub]=50km/hr , you will fly out with velocity 2V[sub]1[/sub]=100km/hr[/b].
If m[sub]1[/sub]<< m[sub]2[/sub] then V[sub]1[/sub]' ? -V[sub]1[/sub]+2V[sub]2[/sub] ; V[sub]2[/sub]'? V[sub]2[/sub];
i.e.  If a small ball hit a wall (V[sub]2[/sub]=0),then the ball will be bounced back (same magnitude,oppositive direction).

For collision 2D, the trick is to transform it into collision 1D problem:
In the direction of red arows, and another direction normal to red arrows (i.e. direction of green arrows).
If friction is not considered (which will cause both balls to rotate due to friction force),
Then green arrow velocity is not changed after the collision because there is no force in that direction.
And collision in red arrow direction is 1D collision problem, so you can use the above equation.
However, you need to calculate the component of velocity in red arrow direction. (This you need to understand the meaning of inner product -- mathematic operation).