The real collision should have occured before you detected that the distance between two center of the balls d is less than the sum of those two balls r1+r2. The correct way is to find the time when the two ball real collide with each other. Suppose the center of those two ball are x1,y2 and x2,y2 dx=x2-x1, dy=y2-y1; d=sqrt(dx*dx+dy*dy); First calculate the component of velocity in the direction of (dx,dy) vp1= vx1 *dx/d+vy1*dy/d; vp2= vx2*dx+vy2*dy/d; Collision should have happened dt before you have detected r1+r2<d; and dt =(r1+r2-d)/(vp1+vp2); So you should move those two ball backward x1-= vx1*dt; y2 -= vy1*dt; x2-=vx2*dt; y2-=vy2*dtl Now the distance between center of the two balls is d'=r1+r2; Apply the collision to calculate new velocity for those two balls after collision. Support new velocity are vx1' , vy1', vx2',vy2' You need to move time dt forward so x1+= vx1'*dt; y1+=vy1'*dt; x2+=vx2'*dt; y2+=vy2'*dt; You can check out [url=http://www.phy.ntnu.edu.tw/ntnujava/viewtopic.php?t=173]another simulation created with EJS[/url] and find out how I did it with EJS.