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.

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

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 12
• 17
• 10
• 14
• 10
• Forum Statistics

• Total Topics
632660
• Total Posts
3007694
• Who's Online (See full list)

There are no registered users currently online

×