How to calculate velocities after collision? I'm currently writing a program for a particle simulator. One of the requirements is that the particles collide in a realistic way. However, I don't know how to calculate the final velocities.
For each collision, I have the $x$-component and $y$-component of each velocity, as well as the displacement and mass of each particle.
Is it possible to calculate the direction and magnitude of their velocities after the collision? If so, how?
 A: 2 dimensional collision can be reduced to a 1-dimensional problem in the case of spheres--see here. The $\pm$ you encounter when solving the kinetic energy is likely because there are two solutions and the equations are satisfied by either one. One solution is simply where the particles pass right through eachother, which you can discard.
A: Note: The simplest method of calculating collisions use some method of applying impulses to objects that collide at some point in time. The simplest algorithm is to test if two objects are intersecting at some point in time, and if they are you fix it so that they stop intersecting each other, and then apply the calculated impulses on each object. However, this isn't completely correct. You really need to find out which collisions happened first, step the whole simulation back to the moment of the first collision, and calculate the new velocities right then. This works correctly if you have many momentary and interdependent collisions.
In the worst case, if the particles are dense and come into contact with each other, the easiest method I've found (which is used in this simulation and which I used to handle collision in this simulation) is to use forces instead of impulses. Again you reduce it to a 1-dimensional problem, and have the force of interaction between two particles be:
$$f=-k d-\mu v$$
where $\mu$ and $k$ are constants, $-k d$ is a Hookean spring repulsive force, $v$ is the relative velocity of the two particles along their axis of collision, and $-\mu v$ is a viscous friction force.
I believe that if you want more accurate contact physics (with accurate sliding point contacts instead of a spring force) you'll have to use a much more sophisticated method.
