# Matrix rotation

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

## 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 on other sites
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 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 on other sites
Quote:
 Original post by jykIn 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.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 46
• 22
• 27
• ### Forum Statistics

• Total Topics
634047
• Total Posts
3015227
×