Can you use LaTeX? It'll make your equations easier to decypher and people will help you faster!
From what I see you are having a 2D collision between two cars. Correct?
Shouldn't this:
Code:
vnew = (mass * vspeed + other.mass + other.vspeed - other.mass * E * (other.vspeed - vspeed)) / mass + other.mass;
hnew = (mass * hspeed + other.mass + other.hspeed - other.mass * E * (other.hspeed - hspeed)) / mass + other.mass;
other.vnew = (other.mass * other.vspeed + mass + vspeed - mass * E * (vspeed - other.vspeed)) / other.mass + mass;
other.hnew = (other.mass * other.hspeed + mass + hspeed - mass * E * (hspeed - other.hspeed)) / other.mass + mass;
Actually be this:
Code:
vnew = (mass * vspeed + other.mass * other.vspeed - other.mass * E * (other.vspeed - vspeed)) / (mass + other.mass);
hnew = (mass * hspeed + other.mass * other.hspeed - other.mass * E * (other.hspeed - hspeed)) / (mass + other.mass);
other.vnew = (other.mass * other.vspeed + mass * vspeed - mass * E * (vspeed - other.vspeed)) / (other.mass + mass);
other.hnew = (other.mass * other.hspeed + mass * hspeed - mass * E * (hspeed - other.hspeed)) / (other.mass + mass);