Search code examples
rotationpitcheuler-angles

Yaw, Pitch and Roll to vectorDir and vectorUp


I have yaw, pitch and roll from an object and i need to transform it into vectorDir and vectorUp. Someone an idea of how to do it?


Solution

  • I would convert the Euler angles (yaw, pitch and roll) into a rotation matrix M. Follow this answer for example.

    It is not 100% clear what you need but you it is one of the followings.

    You get vectorDir by multiplying the column vector x=[1,0,0] by either M or its transpose.

    You get vectorUp by multiplying the column vector z=[0,0,1] by either M or its transpose.

    Note. Euler angles are evil, they screw up the stability of your app, see for example

    They are not useful for interpolation either.