# Quaternion to degree....

This topic is 2905 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 making a 2D Mario like game and I want to use the Bullet-library for the physics. Bullet runs fine so far, but I have trouble with converting the quaternion rotation into degrees (Which Direct2D wants). Since it is 2D, I only need one axis (I think it's the Z-Component of the quaternion-vector). Here is what I tried, but it gives only half-correct results, so I think I do it wrong. [smile]

##### Share on other sites
I just found
D3DXQuaternionToAxisAngle
but I don't know how to use it...

##### Share on other sites
Use the quaternion to transform a vector (1,0,0), then take the transformed vector, ignore the Z component, and calculate atan2(Y,X) to obtain the angle around the Z axis the rotation represents.

##### Share on other sites
That worked, thank you!

1. 1
2. 2
3. 3
4. 4
Rutin
18
5. 5

• 11
• 21
• 12
• 12
• 11
• ### Forum Statistics

• Total Topics
631406
• Total Posts
2999897
×