#### Archived

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.

## Recommended Posts

Hi, given yaw, pitch and roll, how do I find the 3d vector of x magnitude? Many Thanks.

##### Share on other sites
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 on other sites
yeah the starting vector would be looking down the z axis

the angles, yaw, and pitch are relative to the starting vector right?

yup.

thanks =D

1. 1
Rutin
19
2. 2
3. 3
4. 4
5. 5
frob
12

• 15
• 13
• 9
• 12
• 10
• ### Forum Statistics

• Total Topics
631442
• Total Posts
3000103
×