mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
refs #332 send slew mode position packet instead of the full one
This bypasses the physics engine inside FS9
This commit is contained in:
@@ -136,6 +136,35 @@ namespace BlackSimPlugin
|
||||
return positionVelocity;
|
||||
}
|
||||
|
||||
MPPositionSlewMode aircraftSituationtoFS9(const CAircraftSituation &situation)
|
||||
{
|
||||
MPPositionSlewMode positionSlewMode;
|
||||
|
||||
// Latitude - integer and decimal places
|
||||
double latitude = situation.getPosition().latitude().value(CAngleUnit::deg()) * 10001750.0 / 90.0;
|
||||
positionSlewMode.lat_i = static_cast<qint32>(latitude);
|
||||
positionSlewMode.lat_f = qAbs((latitude - positionSlewMode.lat_i) * 65536);
|
||||
|
||||
// Longitude - integer and decimal places
|
||||
double longitude = situation.getPosition().longitude().value(CAngleUnit::deg()) * ( 65536.0 * 65536.0) / 360.0;
|
||||
positionSlewMode.lon_hi = static_cast<qint32>(longitude);
|
||||
positionSlewMode.lon_lo = qAbs((longitude - positionSlewMode.lon_hi) * 65536);
|
||||
|
||||
// Altitude - integer and decimal places
|
||||
double altitude = situation.getAltitude().value(CLengthUnit::m());
|
||||
positionSlewMode.alt_i = static_cast<qint32>(altitude);
|
||||
positionSlewMode.alt_f = (altitude - positionSlewMode.alt_i) * 65536;
|
||||
|
||||
// Pitch, Bank and Heading
|
||||
FS_PBH pbhstrct;
|
||||
pbhstrct.hdg = situation.getHeading().value(CAngleUnit::deg()) * CFs9Sdk::headingMultiplier();
|
||||
pbhstrct.pitch = situation.getPitch().value(CAngleUnit::deg()) * CFs9Sdk::pitchMultiplier();
|
||||
pbhstrct.bank = situation.getBank().value(CAngleUnit::deg()) * CFs9Sdk::bankMultiplier();
|
||||
positionSlewMode.pbh = pbhstrct.pbh;
|
||||
|
||||
return positionSlewMode;
|
||||
}
|
||||
|
||||
HRESULT printDirectPlayError(HRESULT error)
|
||||
{
|
||||
switch(error)
|
||||
|
||||
Reference in New Issue
Block a user