Jump to content
  • Advertisement
Sign in to follow this  
mind in a box

Quaternion to degree....

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

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 this post


Link to post
Share on other sites
Advertisement
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 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!