Jump to content
  • Advertisement


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

Maverick the divider

Quaternion manipulation

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

Maybe anyone can explain one simple thing about quaternions. Like, i have a quaternion to do my rotation, but if i multiply it over my orientation quaternion, it''s frame-dependant movement. So is there a way to have a part of the rotation aplied or will i have to generate new quaternions each time?

Share this post

Link to post
Share on other sites
I''m not exactly sure what you mean, but I think it has something to do with adding a ''rotation velocity'' to the rotation, right?

Say your rotation velocities are stored in a vector3 called ''omega'', and the current orientation of your object is in a quaternion called ''q''. To proceed to the next frame with a certain ''deltaTime'' I use the following step:

quat qdot(q * quat(vector3(omega.x, omega.y, omega.z), 0.0f) * 0.5f);
qnew = q + (qdot * deltaTime);

This should give you the new orientation ''qnew'', which you can then (after checking if there are collisions in your scene you might have to resolve) put into the orientation of the object.

Hope this is what you were searching for..


Share this post

Link to post
Share on other sites
Hmm, my object turns around anywhere he wants, this is what i've done:

if (Engine->_Input->KeyDown(DIK_A)) {
D3DXQuaternionDot(&qdot, &(D3DXQUATERNION(0, 0.02f, 0, 0) * 0.5f));
qOrientation = qOrientation * (qdot * Elapsed);
D3DXQuaternionNormalize(&qOrientation, &qOrientation);

[edited by - Maverick the divider on May 31, 2002 12:43:27 AM]

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!