Sign in to follow this  

Torque to angles

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

This depends also on the time duration you want to observe for rotation and the bodies initial velocity.
You need to refine your question, what do you want to achieve?

Whant we can get from your given numbers is the angular acceleration (rate of change of angular velocity):

vec3 angAcc = bodyWorldMatrix.Unrotate (torque); // rotate torque to local body space, because inertia is relative to local space usually
angAcc[0] /= Ixx; // divide component wise by inertia
angAcc[1] /= Iyy;
angAcc[2] /= Izz;
angAcc = bodyWorldMatrix.Rotate (angAcc); // rotate back to world space and we have angular velocity

You then can get the axis and angle of angular acceleration simply by

float angle = angAcc.Length();
vec3 axis = angAcc / angle; // Don't forget to check gainst error epsilon before the divide ;)

Or, if you want to know angular acc about a given dirction e.g. X axis:

float xAngle = vec(1,0,0).Dot(angAcc); Edited by JoeJ

Share this post


Link to post
Share on other sites
Good idea but i think it does not work because inertia is a nonuniform scale which can't be rotated without distortion.
Try it out to be sure. (I'm talking about inertia stored as 3 values, not as a 3x3 matrix)

Notice that a vector Unrotate() needs the same operation as a Rotate(), because the inverse of orthonormal orientation is just it's transpose you can hardcode this, e.g.:

Unrotate:
return Vector3(
( ( ( vec.getX() * mat.getCol0().getX() ) + ( vec.getY() * mat.getCol0().getY() ) ) + ( vec.getZ() * mat.getCol0().getZ() ) ),
( ( ( vec.getX() * mat.getCol1().getX() ) + ( vec.getY() * mat.getCol1().getY() ) ) + ( vec.getZ() * mat.getCol1().getZ() ) ),
( ( ( vec.getX() * mat.getCol2().getX() ) + ( vec.getY() * mat.getCol2().getY() ) ) + ( vec.getZ() * mat.getCol2().getZ() ) )
);

Rotate:
return Vector3(
( ( ( mCol0.getX() * vec.getX() ) + ( mCol1.getX() * vec.getY() ) ) + ( mCol2.getX() * vec.getZ() ) ),
( ( ( mCol0.getY() * vec.getX() ) + ( mCol1.getY() * vec.getY() ) ) + ( mCol2.getY() * vec.getZ() ) ),
( ( ( mCol0.getZ() * vec.getX() ) + ( mCol1.getZ() * vec.getY() ) ) + ( mCol2.getZ() * vec.getZ() ) )
);


But it is possible to store an additional inertia tensor 3x3 matrix in world space.
I don't because it needs space for every body. Edited by JoeJ

Share this post


Link to post
Share on other sites

This topic is 664 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.

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