Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Angles to Vector

This topic is 6003 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 forum... how do i convert the rotation-angles of a object into direction-vectors ? because: i want to move a object along its own axis (not worldaxis. i found this (angle to vector): #define PI_OVER_180 0.01745329F vec.x = -sin(angle.y*PI_OVER_180)*cos(angle.x*PI_OVER_180); vec.y = sin(angle.x*PI_OVER_180); vec.z = cos(angle.y*PI_OVER_180)*cos(angle.x*PI_OVER_180); but how do i: 1. implement z-axix rotation support 2. the above only calculates the forward-vector, whats about the other directions (backward,up,down,left,rigth)i think -(vec)is the opposite direction ... any ideas?

Share this post

Link to post
Share on other sites
The angle.x and angle.y represent elevation and azimuth I think.
Elevation is the angle between the object axis and z axis(or XY plane, depends on your definition) In your code elevation is angle.x.Azimuth is the angle between X axis and the projected vector of the object axis onto XY plane. Basically you have 2 variables to represent a looking direction. If you want the roll(correct?) that represents rotation about the objects axis it makes three.

Now, if you want to find the UP vector, do the same calculation but this time use elevation+PI/2. (assuming elevation angle is the one between the axis angle and XY plane). To find the RIGHT
use azimuth + PI/2 with the same calculation.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!