# (Impulse) Change in Angular Velocity or Angular Momentum?

## Recommended Posts

Irlan    4067
I'm implementing a physics simulation for my final course project and updating the rigid bodies like this:

calc_forces(); //calc constant forces and torques

velocity += (force / mass) * dt;
position += velocity * dt;

ang_momentum += torque * dt;
orientation += ( (ang_vel * orientation) * 0.5f ) * dt;

orientation.normalize();

ang_vel = inverseInertia * ang_momentum;

//IF COLLIDE WITH OTHER

velocity += ( (j * collision.cn) + (u * j) * collision.ct ) / mass;
ang_vel += pt1.cross( (j * collision.cn) + (u * j) * collision.ct ) * inverseInertia;

other.velocity += ( (-j * collision.cn) + (u * j) * collision.ct ) / other.mass;
other.ang_vel += pt2.cross( (-j * collision.cn) + (u * j) * collision.ct ) * other.inverseInertia;

I've read the Baraff's papers but i think that what i'm doing is "no change in angular momentum" and in this moment I don't have any idea how to calculate.
Obs: when i change ang_vel to ang_momentum, the results are better but i want correctly results.

##### Share on other sites
EWClay    659
The only obvious problem is that you are changing angular velocity in the collisions and overwriting it in the update, so the change would have no effect. As you seem to realise, changing angular momentum is better.

If it still looks wrong, there could be plenty of reasons that are unconnected to the code above.