Jump to content
  • Advertisement
Sign in to follow this  
AbsolutDew

How do you get the facing of a D3DXQUATERNION?

This topic is 4399 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 thought quaternions fully described orientation in 3d space, but I haven't been able to figure out how to get the direction it's facing. Am I way off here? I see how to transform a vector by a quaternion with D3DXVec3TransformCoord, do I need to keep track of the direction seperately? That would suck =/ Not much of a DirectX question but (if possible) I'd like to confine myself to the D3DX family of math functions for the time being.

Share this post


Link to post
Share on other sites
Advertisement
Quaternions don't face a direction. Quaternion is just a construct, a set of numbers. It can be interpreted as a rotation description. But I've yet to see it interpreted as a "direction".

Quaternion is an extention of angle in 2D - to 3D. You don't ask of a direction of an angle => you don't ask of a direction of a quaternion. A quaternions doesn't describe orientation - it describes a rotation of some base orientation. In order to ask of a final orientation (after being rotated) you've got to answer the question -> "what's your base orientation?".


I figure you're asking of the outcome of vector (0,0,1) transformed by a quaternion. Is that right?

Share this post


Link to post
Share on other sites
Quote:
Original post by deffer
Quaternions don't face a direction. Quaternion is just a construct, a set of numbers. It can be interpreted as a rotation description. But I've yet to see it interpreted as a "direction".

Quaternion is an extention of angle in 2D - to 3D. You don't ask of a direction of an angle => you don't ask of a direction of a quaternion. A quaternions doesn't describe orientation - it describes a rotation of some base orientation. In order to ask of a final orientation (after being rotated) you've got to answer the question -> "what's your base orientation?".


I figure you're asking of the outcome of vector (0,0,1) transformed by a quaternion. Is that right?


I guess I didn't really know what I was asking. So a quaternion can fully describe orientation if I combine it with a base orientation like (0,0,1)? Why would you pick that particular one?

Oh, that would be the up vector normally passed to 3DXMatrixLookAtLH!

Share this post


Link to post
Share on other sites
generally when you want to translate something "forward" you do it in the positive z direction. That's entirely arbitrary and dependant on the coordinate system you're using.

Quaternion * Vector effectively rotates the vector according to the quaternion, so if positive z is "forward" then multiplying (0, 0, 1) by your quaternion will effectively give you the direction it's facing

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!