0

I have 3 angles, each representing yaw, roll, and pitch.

I would like to convert these into a direction vector (created from the yaw and pitch) and a right vector, which is perpendicular to the direction vector and rotated by the "roll" angle.

I have figured out the direction part from this post, but I cannot figure out how to calculate a right vector at an angle.

My function so far is like this:

// "angles" is an input, while "direction" and "right" are outputs
// "angles" has x as the rotation about the x axis, y as the rotation
// about the y axis, and z as the rotation of the right vector 
// around the direction vector
void angles_to_vectors(glm::vec3 angles, glm::vec3* direction, glm::vec3* right)
{
    *direction = glm::normalize(
            glm::vec3(glm::cos(angles.y) * glm::cos(angles.x),
                      glm::sin(angles.y) * glm::cos(angles.x),
                      glm::sin(angles.x)));

    // Part I am stuck on
    *right = glm::vec3(/* What goes in here? */);
}

Any help is appreciated.

Username
  • 161
  • 3
  • 13
  • Please give examples of input angles and desired result, preferrably with some explanation. – Yunnosch Apr 05 '19 at 05:24
  • You have a direction d. If you have only one vector there is a 2D subspace left of 3D-vectors that are perpendicular to this vector d. Do you can assume another vector like an up-vector? –  Apr 05 '19 at 05:28

0 Answers0