diff --git a/src/plugins/simulator/xplane/simulatorxplane.cpp b/src/plugins/simulator/xplane/simulatorxplane.cpp index dec8001ff..dfb639508 100644 --- a/src/plugins/simulator/xplane/simulatorxplane.cpp +++ b/src/plugins/simulator/xplane/simulatorxplane.cpp @@ -321,7 +321,7 @@ namespace BlackSimPlugin::XPlane m_serviceProxy->getOwnAircraftCom2DataAsync(&m_xplaneData); m_serviceProxy->getOwnAircraftXpdrAsync(&m_xplaneData); m_serviceProxy->getAllWheelsOnGroundAsync(&m_xplaneData.onGroundAll); - m_serviceProxy->getGroundElevationAsync(&m_xplaneData.groundElevation); + m_serviceProxy->getHeightAglMAsync(&m_xplaneData.heightAglM); CAircraftSituation situation; situation.setPosition({ m_xplaneData.latitudeDeg, m_xplaneData.longitudeDeg, 0 }); @@ -334,7 +334,7 @@ namespace BlackSimPlugin::XPlane situation.setPitch({ m_xplaneData.pitchDeg, CAngleUnit::deg() }); situation.setBank({ m_xplaneData.rollDeg, CAngleUnit::deg() }); situation.setGroundSpeed({ m_xplaneData.groundspeedMs, CSpeedUnit::m_s() }); - const CAltitude elevation { std::isnan(m_xplaneData.groundElevation) ? 0 : m_xplaneData.groundElevation, CAltitude::MeanSeaLevel, CLengthUnit::m() }; + const CAltitude elevation { m_xplaneData.altitudeM - m_xplaneData.heightAglM, CAltitude::MeanSeaLevel, CLengthUnit::m() }; situation.setGroundElevation(elevation, CAircraftSituation::FromProvider); situation.setVelocity({ m_xplaneData.localXVelocityMs, m_xplaneData.localYVelocityMs, m_xplaneData.localZVelocityMs, CSpeedUnit::m_s(), m_xplaneData.pitchRadPerSec, m_xplaneData.rollRadPerSec, m_xplaneData.headingRadPerSec, diff --git a/src/plugins/simulator/xplane/simulatorxplane.h b/src/plugins/simulator/xplane/simulatorxplane.h index 7bae0da72..f22159eb2 100644 --- a/src/plugins/simulator/xplane/simulatorxplane.h +++ b/src/plugins/simulator/xplane/simulatorxplane.h @@ -75,6 +75,7 @@ namespace BlackSimPlugin::XPlane double latitudeDeg = 0; //!< Longitude [deg] double longitudeDeg = 0; //!< Latitude [deg] double altitudeM = 0; //!< Altitude [m] + double heightAglM = 0; //!< Height AGL [m] double groundspeedMs = 0; //!< Ground speed [m/s] double pitchDeg = 0; //!< Pitch [deg] double rollDeg = 0; //!< Roll [deg]