Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

(Impulse) Change in Angular Velocity or Angular Momentum?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 Irlan Robson   Members   

4056
Like
0Likes
Like

Posted 13 March 2013 - 09:11 AM

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. 


#2 EWClay   Members   

659
Like
0Likes
Like

Posted 13 March 2013 - 03:22 PM

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.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.