   collision response problem with COR
  This is a simplified look at my collision response routine..I have two objects.  One has mass m1 and velocity u1, and the other has mass m2 and velocity u2.I want to calculate their final velocities v1 and v2.I read the wiki article about the coefficient of restitution and the formulas that were listed didn't seem to work.. so I decided to solve for myself the system of linear equations that were listed below the formulas.m1 * u1 + m2 * u2 = m1 * v1 + m2 * v2COR * (u1 - u2) = v2 - v1...let p = m1 * u1 + m2 * u2let q = COR * (u1 - u2)v1 = (p - m2 * q) / (m1 + m2)v2 = (p + m1 * q) / (m1 + m2)For some reason, when COR is 1.0 (perfectly elastic), the final total momentum seems to be higher than the starting total momentum.  However, when I make COR equal 0.0 (perfectly inelastic), the momentums stay the same.  This doesn't make sense at all because momentum should be conserved no matter what the COR.Am I doing something wrong here?  Or is this correct and something else in my routine is messed up?Thanks.   
  Your equations seem to be correct.Note that the total momentum is a vector sum; if system has 2 objects of equal mass moving towards each other with equal velocity, the individual momentums would cancel out to give a total momentum of zero.;  As the person who wrote the wiki page, I assure you the equations are correct.  I used them in my first proper physics engine with great results. As chand pointed out, make sure you're not having problems with the direction your velocities are pointed (ie: positive or negative).   ;  How I computed my total momentum was wrong.. I was using the magnitude of the velocites, not the velocity vectors themselves.. so I corrected that.I'm still having trouble getting it to work, though.  When COR is 1.0, it works perfectly: momentum is conserved during the simulation.  However, when COR is anything else between 0.0 and 1.0, momentum no longer is conserved (it decreases when COR is below 1.0).. is this supposed to be the case?  I thought momentum was conserved no matter what.  Maybe there's something else wrong with my engine?   ;  Momentum should always be conserved.  For energy, not necessarily.  Are you maybe confusing energy and momentum?  What you describe would make perfect sense if this were the case.  Otherwise post a test case that shows when conservation of momentum is violated.FYI, the two equations in the wiki article...  One of them is the law of conservation of momentum.  So if momentum is being lost somewhere, it probably isn't from the COR, since it has to satisfy conservation of momentum explicitly.   ;It's definitely momentum which is decreasing, not energy.  Just to make sure though.. when I compute the total momentum, I'm going through all the bodies in the world and multiplying their velocity vectors by their masses and summing the resulting momentum vectors.  This is correct, right?And that's what's so weird about my problem.. the final v1 and v2 have to satsify the law of conservation of momentum becuase that was one of the equations.. yet it's not!  Very frustrating..I'll grab some output from my engine and post it a little later..;Well.. I was wrong.. the equations are perfect.. the way I was handling the velocity vectors and their magnitudes was flawed.. so the equations were working but they were computing final velocities using incorrect initial velocity data.But it works now.. or at least I know the problem now.. so thanks!;Another question..Is there a "better" way of computing the collision response than the method I'm currently using..?  Instead of plugging the velocities into the system of equations and getting the new velocities out, is it possible to use some sort of impulse based method where I compute the impulse for each object?  I have a feeling something like this exists because there's no way the system of equations method would work with non-spherical objects.. so anyone know?Thanks.;  The two (setting the velocity, and using impulses) are actually the same, since mass isn't going to change during a collision, and you're collision response is usually seperate from your other "forces".For a slightly different approach to using the COR, check out Hecker's article, which solves for an impulse and applies it to the velocity using the COR.  With Hecker's method, you can more easily incorporate angular momentum and even multiple collision points  (I'm experimenting with this right now.  You'll have a system of equations to solve for, one equation for each collision point).  Just different ways of approaching the same problem.Hecker's article was in the external links section on the Wikipedia page.  Now that I think about it, it might be good for me to write up another section on solving for the impulse and applying it to find final velocities.   ;  Conservation of energy is the more general law: Energy can neither be created nor be destroyed - it can only be changed from one form to another!Conservation of momentum is more concerned about conserving kinetic energy. And the coefficient of restitution (COR) determines what percent of the total kinetic energy is converted to some other form (heat) in the event of an inelastic (COR<1) collision. The loss in kinetic energy = (1-COR) %I've been studying Hecker's articles myself. Also checked out the book "Physics for game developers". Unfortunately neither explain how the impulse for angular effects is derived. When colliding translating and rotating bodies, the total angular momentum (about any fixed reference point) needs to be conserved. (think about this: even a point mass (particle) moving in a straight line has angular momentum w.r.t. a fixed reference point (say the origin)). Here is a nice resource.I will continue my investigation on this...