   Reactions
  I am trying to write a simulation with a bouncing ball. I have done this before but I have lost where I found the formulas and all i have to go on is the source code i used, which dosent seem to work in my simulation.Anyway here is the code im using, it is being called once when the ball collides with a plane.void tpRigidBody::reactToCollision(tpPlane plane){m_position = m_previousPosition; // Resets the position so a collision only occurs once.float speed = m_velocity.length();// Get the speed of the balltpVector reflection;tpVector vel = m_velocity.normalise();    //reflection = vel - (( 2*vel.dotProduct(planenormal) )*planenormal);//reflection = tpVector::subtract( vel, tpVector::multiply( vel.multiply( 2,tpVector::DotProduct( vel,plane.getNormal())),plane.getNormal()));reflection = tpVector::multiply( tpVector::DotProduct(vel,plane.getNormal())*2, plane.getNormal() );reflection = tpVector::subtract( vel, reflection );reflection = reflection.normalise();float J = -((1+m_elasticity) * tpVector::DotProduct(vel, plane.getNormal()) / (1 / m_mass)); // impulsespeed = speed -(J / m_mass);m_velocity = tpVector::multiply(speed,reflection);}The reflection code works fine, the ball always bounces in the direction its supposed to. The ball never stops, for some reason the coefficient of elasticity dosent seem to work.Any ideas of what I may be doing wrong, or anywhere I might be able to look to find the formula I need. Google dosent seem to know the answer >_<   
  Nevermind, i figured it out.The line,speed = speed -(J / m_mass);should be,speed = speed -(J * m_mass);   