0
\$\begingroup\$

Given:

float yaw, pitch, roll;

How does one compute the forward direction:

vec3 forward = computeForwardFromEulers(yaw, pitch, roll);

Next, I would like to use this information to translate an object along this axis / heading / forwardDirection.

// move 1 unit forward 
forward.?? = 1.0f?
\$\endgroup\$
1
\$\begingroup\$

https://stackoverflow.com/questions/1568568/how-to-convert-euler-angles-to-directional-vector

This should answer the first part of your question. A simple google search gave me this result.

For translating, you want to multiply the direction you want to move by the length you want to move. So, if you want to move forward by 5.0 units, you would write:

position = position + forward * 5.0

This will move you towards forward by 5.0 units. You can do this with any directional vector:

position = position + GlobalUpVector * 2.0
|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.