Commit 8a2144d9 authored by stoutjesdijk's avatar stoutjesdijk 🎧
Browse files

sync to main

parent 20d79bba
Loading
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -196,9 +196,15 @@ void Quat2Euler(
{
    if ( quat.w != -3.0 )
    {
#ifdef FIX_I109_ORIENTATION_TRACKING
        *roll = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) );
        *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) );
        *yaw = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) );
#else // bug: x and z swapped
        *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) );
        *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) );
        *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) );
#endif
    }
    else
    {