mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
Use bitwise negation operator to invert integer pitch and bank angles
refs #790
This commit is contained in:
committed by
Klaus Basan
parent
5d7eff0797
commit
7f90652b2f
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user