Sign in to follow this  

(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;
ang_vel = inverseInertia * ang_momentum;
velocity += ( (j * + (u * j) * collision.ct ) / mass;
ang_vel += pt1.cross( (j * + (u * j) * collision.ct ) * inverseInertia;
other.velocity += ( (-j * + (u * j) * collision.ct ) / other.mass;
other.ang_vel += pt2.cross( (-j * + (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 this post

Link to post
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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this