Jump to content
The simFlight Network Forums

C# Get correct pitch and bank values


Recommended Posts

Hey everybody,

i'm working with the fsuipcclient 3.0 in my c# project. I've some problems with two offsets (pitch and bank). I get the wrong values from fsuipc. i tested it syncron with simconnect. The values from simconnect are correct, fsuipc send wrong values (i think or i made a mistake). I found some solutions in this forum but it doesnt work for me.

Here my code:


private static readonly Offset<double> AirplanePitch = new Offset<double>(0x0578);
private static readonly Offset<double> AirplaneBank = new Offset<double>(0x057C);

And receive the data:

internal static void GetPitchRoll()
     MyAircraft.Pitch = AirplanePitch.Value * 360.0 / (65536.0 * 65536.0);
     MyAircraft.Roll = AirplaneRoll.Value * 360.0 / (65536.0 * 65536.0);


I've got only values between -1.5 deg and  + 1.5 deg. Simconnect send me the correct values from -50deg and + 50deg. Is my calculation wrong?


I've tested it with other types (float, int, long) but the same :(


Edited by sirbenson
Link to comment
Share on other sites

These offsets are 4-byte integers so should be declared as 'int'

                Offset<int> playerPitch = new Offset<int>(0x0578);
                Offset<int> playerBank = new Offset<int>(0x057C);

Here's the conversion that I use in the DLL to calculate the pitch/roll in degrees. This works fine.

                snapshot.PitchDegrees = ((double)playerPitch.Value * 360d) / (65536d * 65536d);
                snapshot.BankDegrees = ((double)playerBank.Value * 360d) / (65536d * 65536d);


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.