Converts Unity's specific (improper) Euler angles into a 4-dimensional quaternion vector (w, x, y, z) for further computations.

eulunity2quaternion(rot_x, rot_y, rot_z)

Arguments

rot_x

Euler x angle in degrees

rot_y

Euler y angle in degrees

rot_z

Euler z angle in degrees

Value

A numeric vector of length 4 representing the unit quaternion c(w, x, y, z).

Details

  1. Unity uses (improper) Euler angles to output their internal quaternion representation.

  2. These angles describe extrinsic rotations around the Z - X - Y coordinate axis.

  3. The angles are given as clockwise when the axis is pointing towards the observer as the coordinate system is left-handed.

If rot_x rot_y and rot_z are columns then this function returns an nx4 matrix where n is the length of the column