diff --git a/libraries/Desktop/support/sitl_compass.cpp b/libraries/Desktop/support/sitl_compass.cpp index 1876a3f532..0040652671 100644 --- a/libraries/Desktop/support/sitl_compass.cpp +++ b/libraries/Desktop/support/sitl_compass.cpp @@ -48,7 +48,7 @@ static Vector3f heading_to_mag(float heading, float roll, float pitch, float yaw cos_pitch = 1.0e-10; } - v.z = -0.4; + v.z = -0.6*cos(roll)*cos(pitch); v.y = (headY + v.z*sin_roll) / cos_roll; v.x = (headX - (v.y*sin_roll*sin_pitch + v.z*cos_roll*sin_pitch)) / cos_pitch; scale = magnitude / sqrt((v.x*v.x) + (v.y*v.y) + (v.z*v.z));