Jump to content
The simFlight Network Forums

MoveAircraft causing reload


Recommended Posts

Hi Paul,

After my query the other day about sending key presses to FSX, my code is working perfectly, BUT I am using both simConnect and FSUIPC Client.  This seems a bit over the top, since the only thing I want to do in simconnect now is move the aircraft to a give latitude and longitude. 

 

 FsLatLonPoint fsLatLonPoint = new FsLatLonPoint(lat,lon);
            FsAltitude fsAltitude = new FsAltitude(0);


            //Send Structure to simconnect to position aicraft
            //simconnect.SetDataOnSimObject(DEFINITIONS.Struct1, 0, SIMCONNECT_DATA_SET_FLAG.DEFAULT, s);
            FSUIPCConnection.MoveAircraft(fsLatLonPoint, true, fsAltitude, 0, 0, 0, 0, true);

As you can see above, I commented out the simconnect instruction and replaced with the FSUIPCConnection instruction.  Whilst it works, FSX then Loads Terrain, ATC etc after each move.  Any idea why and how I can stop this?

 

Many thanks

Martin

 

Link to comment
Share on other sites

Hi Martin,

The MoveAircraft() method uses the "Initial Position" feature in FSUIPC that makes sure the scenery, weather, atc etc gets reloaded. This is normally used for things like instructor stations that get you set up for an approach to a selected airport. You would want everything reloaded in that case.

If you don't want to reload the scenery etc, then you can write directly to the Aircraft Longitude, Latitude, Heading, Altitude offsets etc.

Example using just Lon and Lat:

Declare offsets..

private Offset<FsLongitude> playerLon = new Offset<FsLongitude>("Position", 0x0568, 8);
private Offset<FsLatitude> playerLat = new Offset<FsLatitude>("Position", 0x0560, 8);

Move aircraft...

            this.playerLat.Value = lon; // lon here is an instance of FsLongitude
            this.playerLon.Value = lat; // lat here is an instance of FsLatitude
            FSUIPCConnection.Process("Position"); // Instant move, no reload. 

Paul

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.