Jump to content
  • Advertisement
Sign in to follow this  
Foxostro

Matrix rotation

This topic is 4836 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

Hi! I'm using 3x3 matrices to represent the facing of an object, its angular velocity, and angular acceleration. Every tick, I integrate the two latter matrices with respect to time to update the facing matrix. My question is, how can I get the axial vector about which the matrix for angular velocity will rotate the object's facing? I would like to cause the object to have a tendency to stop rotating even when no torques are acting apon it. I think I could do this by applying a "friction"-like torque to the object across this axis.

Share this post


Link to post
Share on other sites
Advertisement
This seems like it would be handled better with quaternions. In any case the quaternion math is useful in this instance. Just transform the matrix into a quaternion and extract the x, y, z components from the quaternion to find the axis. An example of the math necessary to do this is here.

To generate a "friction" torque just apply a low acceleration counter to the current angular velocity on the same axis.

Share this post


Link to post
Share on other sites
In addition to SiCrane's suggestion, I thought I'd mention that you can extract an axis-angle pair directly from a rotation matrix as well. If you're not ready to move to quaternions, this might be an option for you.

I don't know much about physics simulation, but I'm accustomed to seeing torque and angular momentum, velocity, and acceleration represented as 3-vectors. With this representation it would be quite easy to apply drag, and you wouldn't have to deal with the extraction. I could be way off base about that, though.

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
In addition to SiCrane's suggestion, I thought I'd mention that you can extract an axis-angle pair directly from a rotation matrix as well.


Of course, the equation for extracting axis-angle from a rotation matrix is the same as extracting a quaternion give or take an arcsin.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!