Jump to content
  • Advertisement
Sign in to follow this  
MurphyIdiot

Vector to Degree calculation

This topic is 4288 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 know how to calculate a vector from a degree. I couldn't find any resources online or in my books on how to calculate a vector to a degree which makes me think it's something really easy I'm just not thinking about. I have a heading vector. Its values are x = 1, y = 0, z = 0. I need my model to face towards its heading. I'm using Irrlicht so it uses degrees to specify rotations. How would I convert my heading vector to a degree so the model displays correctly? (Please note that the heading can change to any normal vector) The model by default faces this way: ---> The heading moves the model this way: ^ | | | The camera is high up in the world on the Y axis. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
The dot and cross products can be used to detemine angles. If your 0 degree heading is z, and your facing is a, then:

z * a = |z||a|cos T
|z X a| = |z||a| sin T

Share this post


Link to post
Share on other sites
Quote:
Original post by erissian
The dot and cross products can be used to detemine angles. If your 0 degree heading is z, and your facing is a, then:

z * a = |z||a|cos T
|z X a| = |z||a| sin T


Continuing on with that, use the dot product to find the angle between the two vectors and the cross product to find the axis of rotation.

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!