[XP] For own aircraft elevation, use dataref instead of terrain probe

This commit is contained in:
Mat Sutcliffe
2022-02-08 20:31:28 +00:00
parent d2fadccf4e
commit 8a203046ed
2 changed files with 3 additions and 2 deletions

View File

@@ -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,

View File

@@ -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]