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.