]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/SP/MagicCarpet.cxx
Synchronized with JSBSim/CVS
[flightgear.git] / src / FDM / SP / MagicCarpet.cxx
index 558f39ddbc1339838a3ffe38673ba7d97b636a60..822c1aa89f665a3e24ba41c276a511ae0f7590e8 100644 (file)
@@ -26,7 +26,6 @@
 #endif
 
 #include <simgear/math/sg_geodesy.hxx>
-#include <simgear/math/polar3d.hxx>
 
 #include <Aircraft/controls.hxx>
 #include <Main/globals.hxx>
@@ -86,7 +85,7 @@ void FGMagicCarpet::update( double dt ) {
     _set_Euler_Rates(0,0,0);
 
     // update (lon/lat) position
-    double lat2, lon2, az2;
+    double lat2 = 0.0, lon2 = 0.0, az2 = 0.0;
     if ( fabs( speed ) > SG_EPSILON ) {
        geo_direct_wgs_84 ( get_Altitude(),
                            get_Latitude() * SGD_RADIANS_TO_DEGREES,
@@ -94,8 +93,7 @@ void FGMagicCarpet::update( double dt ) {
                            get_Psi() * SGD_RADIANS_TO_DEGREES,
                            dist, &lat2, &lon2, &az2 );
 
-       _set_Longitude( lon2 * SGD_DEGREES_TO_RADIANS );
-       _set_Latitude( lat2 * SGD_DEGREES_TO_RADIANS );
+        _set_Geodetic_Position( lat2 * SGD_DEGREES_TO_RADIANS,  lon2 * SGD_DEGREES_TO_RADIANS );
     }
 
     // cout << "lon error = " << fabs(end.x()*SGD_RADIANS_TO_DEGREES - lon2)
@@ -117,4 +115,5 @@ void FGMagicCarpet::update( double dt ) {
     _update_ground_elev_at_pos();
     _set_Sea_level_radius( sl_radius * SG_METER_TO_FEET);
     _set_Altitude( get_Altitude() + climb );
+    _set_Altitude_AGL( get_Altitude() - get_Runway_altitude() );
 }