Use bitwise negation operator to invert integer pitch and bank angles

refs #790
This commit is contained in:
Roland Winklmeier
2016-11-04 01:41:03 +01:00
committed by Klaus Basan
parent 5d7eff0797
commit 7f90652b2f
3 changed files with 10 additions and 10 deletions

View File

@@ -78,17 +78,17 @@ namespace BlackSimPlugin
FS_PBH pbhstrct;
pbhstrct.pbh = positionVelocity.pbh;
double pitch = pbhstrct.pitch / CFs9Sdk::pitchMultiplier();
int pitch = pbhstrct.pitch / CFs9Sdk::pitchMultiplier();
if (pitch > 180.0)
pitch -= 360;
double bank = pbhstrct.bank / CFs9Sdk::bankMultiplier();
int bank = pbhstrct.bank / CFs9Sdk::bankMultiplier();
if (bank > 180.0)
bank -= 360;
// MSFS has inverted pitch and bank angles
pitch = -pitch;
bank = -bank;
pitch = ~pitch;
bank = ~bank;
situation.setPitch(CAngle(pitch, CAngleUnit::deg()));
situation.setBank(CAngle(bank, CAngleUnit::deg()));
situation.setHeading(CHeading(pbhstrct.hdg / CFs9Sdk::headingMultiplier(), CHeading::Magnetic, CAngleUnit::deg()));