Jump to content
The simFlight Network Forums

How can I calculate AI Aircraft location from FSUIPC?


Recommended Posts

Hi,

I am trying my best to make a little utility to keep track of active AI aircraft in the area. It is supposed to be some what a traffic board for AI spotting.

I have managed to read values like GS, VS, HDG. Now I am trying to figure out how to read latitude, longitude and altitude for AI aircraft. I cannot seem to find out how. The FSU SDK says:

float lat; // 32-bit float, in degrees, –ve = South

float lon; // 32-bit float, in degrees, –ve = West

float alt; // 32-bit float, in feet

I have read the four bytes, but where do I go form here? How do I convert the 32bit float into lat, lon and altitude?

Hope someone can help me... :shock:

Regards,

Arnt Helge Haland

Link to comment
Share on other sites

I have read the four bytes, but where do I go form here? How do I convert the 32bit float into lat, lon and altitude?

No conversion is necessary. The values are 32-bit floating point values, which are supported as standard on all Intel type PCs. They already are latitude, longitude (both in degrees) and altitude (in metres), as described.

You should read them into variables declared as float (for C/C++) or whatever the equivalent is in the language you are using. If it is not C/C++ please look up in your programming book to find out about floating point numbers and how to declare them and use them.

Regards,

Pete

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.