Jump to content
  • Advertisement


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


3d vector question

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

Guest Anonymous Poster
Depends on what your starting vector is.

If you want your starting vector to be looking down the z axis..then the resultant pyr vector is.

f32 cosP,sinP,cosY,sinY,PYRVec[3];
cosP = cosf(pitch);
sinP = sinf(pitch);
cosY = cosf(yaw);
sinY = sinf(yaw);

PYRVec[0] = cosP * sinY;
PYRVec[1] = -sinP;
PYRVec[2] = cosP * cosY;

Roll isnt calculated into the above because it is not needed for the beginning lookat. PYRVec now contains the normalized direction, so you can now multiply in the magnitude x.

PYRVec[0] *= x;
PYRVec[1] *= x;
PYRVec[2] *= x;

Share this post

Link to post
Share on other sites
Guest Anonymous Poster

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!