Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

d000hg

Using torque+angular impulses to actually get a rotation

This topic is 5271 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m happy with applying a force to get a torque which causes angular acceleration in 2D. I can do the maths easily in 3d to get a torque vector but then I''m unsure what to do next. I''ll have a torque vector and a moment of inertia vector but what do I do with them to get an actual rotation quaternion/matrix. I think the torque vector is the axis about which the angular acceleration takes place? Many thanks.

Share this post


Link to post
Share on other sites
Advertisement
Thanks but too lazy to download right now! Is it code or words?

The other related thing: if I apply many forces to a body, getting many torques, can I just add their vectors to get the total torque on the body?

Share this post


Link to post
Share on other sites
it''s code. One CPP file, commented. It''s a box falling on a plane and resting.

for torques and forces, yeah, you can accumulate them together, and then when you integrate, use the accumulated value.

Share this post


Link to post
Share on other sites
Another thought...
moment of inertia for say a cylinder or box is only easy to know along certain axes. If a torque is applied on an arbitrary vector the rotation axis isn''t on one of these so how do I know what I to use? Can I resolve each torque into 3 along the object''s local axes and do it that way or would the rotation get screwed up?

Share this post


Link to post
Share on other sites
that''s what the inertia matrix is used for. it puts the right amount of angular momentum around the axes of the shape, if you will. you should not have to worry about it though.

The angular velocity vector defines the axis of rotation, and the angular velocity of rotation along that axis. I never got it to work like that though. You can give it a go, instead of using the quaternion malarkey I''m using.

Share this post


Link to post
Share on other sites
Wow...I just kept watching that demo over and over. I wish there was a reset button, or some way to mess around with the box. Cool thing Oliii!

- Aeroum

Share this post


Link to post
Share on other sites
Wish I''d just looked at your code in the 1st place now! Despite using it at work for physics modelling I forgot we use a matrix for I not a vector!
When you get your inverse I matrix which way round is the multiplication going? Is the idea you multiply torques by the orientation matrix then by the invI matrix then get back to world coords?
One little thing, with your integration why do you update the velocity then use the new velocity along with acceleration to get new position? Shouldn''t you use the current velocity with the acceleration, then update the velocity after?

Thanks.

Share this post


Link to post
Share on other sites
quote:
Original post by d000hg
Wish I''d just looked at your code in the 1st place now! Despite using it at work for physics modelling I forgot we use a matrix for I not a vector!
When you get your inverse I matrix which way round is the multiplication going? Is the idea you multiply torques by the orientation matrix then by the invI matrix then get back to world coords?
One little thing, with your integration why do you update the velocity then use the new velocity along with acceleration to get new position? Shouldn''t you use the current velocity with the acceleration, then update the velocity after?

Thanks.


for the integration, you''re right. My physics can be a bit wobbly at times, but I''m getting better

for the toqrues and force calculation, everything is done in world coordinate system. You can very well do the calculations in local coordinates, but that''s more work. To do force and torques and integration into world coordinate system, I just need an inertia matrix also in world coordinate system, then the collision impulse and integration are all resolved in a simple world frame, for every objects.

to get the inertia matrix from local coordinate, to world coordinate, you convert the matrix from local to world coordinates (MTX = Box.Inertia * Orientation.Inverse()), and then orient the inertia matrix with the box orientation (Orientation * MTX).

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!