• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSX:SE Not getting SIM ON GROUND

Messages
1,074
Country
ca-ontario
Hello,

I'm trying to obtain SimConnect's SIM ON GROUND property, but it keeps returning as false (0) even if I am clearly down and stationary on a runway. I think I have everything set up properly:

Event is set up as:

Code:
hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_OBJECT_DATA, "SIM ON GROUND",                  "Bool");

And my DEFINITION_OBJECT_DATA contains a boolean member.

Then, I call:

Code:
hr = SimConnect_RequestDataOnSimObject(hSimConnect, REQUEST_OBJECT_DATA, DEFINITION_OBJECT_DATA, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_ONCE);

And trap it:

Code:
        case SIMCONNECT_RECV_ID_SIMOBJECT_DATA:
        {
            SIMCONNECT_RECV_SIMOBJECT_DATA *pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA*)pData;
           switch(pObjData->dwRequestID)
            {
                case REQUEST_OBJECT_DATA:
                {

                    DWORD ObjectID = pObjData->dwObjectID;
                    structObjectData *pS = (structObjectData*)&pObjData->dwData;

                    // testing
                    printf("SIM ON GROUND: %s\n", pS->SimOnGround? "TRUE":"FALSE");

However, I always get "SIM ON GROUND: FALSE" no matter where the aircraft is. I have other vars in DEFINITION_OBJECT_DATA and they are all sent from the sim correct and accurate.

Has anyone noticed this, and/or been able to obtain the correct value?

thanks,
 
I tried to do this using managed code with C++/CLI :yikes: and after a brief test, it appears to work.

I declared this variable in a struct: double on_ground;

This is my data definition:
Code:
simconnect->AddToDataDefinition(DEFINITIONS::Struct1, "SIM ON GROUND", "Bool", SIMCONNECT_DATATYPE::FLOAT64, 0, SimConnect::SIMCONNECT_UNUSED);

This is where I receive it:
Code:
void simconnect_OnRecvSimobjectDataBytype(SimConnect^ sender, SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE^ data)
{
   switch ((DATA_REQUESTS)data->dwRequestID)
   {
       case DATA_REQUESTS::REQUEST_1:
       {  Struct1^ s1 = (Struct1^)data->dwData[0];
           displayText("Sim on ground?  " + s1->on_ground);

Unfortunately, I haven't got a clue what this code should look like in "normal" C++, but maybe this will give you some idea for what you would like to do.
 
Thanks! Unfortunately, C++ doesn't have the equivalent of simconnect_OnRecvSimobjectDataBytype.

However, upon further looking into it, It turns out that I was checking for it at the wrong location (Inside "choose aircraft" UI). What's confusing is that the default flight is the Aircreation Trike at Friday Harbour, and THAT "location" is in the air (not on ground... I wish we still had our old Meigs field startup location :( ). When choosing another location (runway), I was expecting that the location would be reflected and updated, but it doesn't, until you actually enter the sim.

I changed the default "Choose Aircraft" FLT into one that's on ground, and BINGO, it started showing "SimOnGround" as true.
 
I'm suprised it even works inside the UI. I'd certainly want to wait for the sim to load until getting the vars.
 
I'm suprised it even works inside the UI. I'd certainly want to wait for the sim to load until getting the vars.

It does, but it is a legacy setting from within the sim (or, more precisely, the currently loaded FLT). It looks like sim is always running, but while in UI, it is paused. So, it looks like the sim at startup first loads DEFAULT.FLT (Friday harbour with trike), where SimOnGround is FALSE. If the sim goes into UI at startup (instead directly into flight), you can select Aircraft/Location in "Free Flight" menu, but SimOnGround does NOT get set to TRUE (because you can only start on the ground, on a runway) until you actually accept the setting and go into sim.

Makes sense, but I didn't at first understand the sequence of events. ;)
 
Watch out here though. I don't have a sim on my hand now, so I can't go and verify, but I think there is an option to disable default flight preload. I remember using it on a laptop to make sim load faster.

Either way I know from my own mistakes it's not a good idea to manipulate sim world before you get a note that it's actually started.

Sent from my XT1635-02 using Tapatalk
 
Hmmmm... there is an option to skip UI at startup: (FSX.CFG, OR, through FSX Menu "Settings:General:Show Opening Screen )
[STARTUP]
SHOW_OPENING_SCREEN=0

and load and fly any FLT you previously labelled as "make this the default flight":

[USERINTERFACE]
SITUATION=c:\users\<user>\documents\flight simulator x\MySavedFlight

if this entry is missing or empty, It will be defaulted to:
SITUATION=FLIGHTS\OTHER\FLTSIM

However, if you go into UI as you start FSX,

[STARTUP]
SHOW_OPENING_SCREEN=1

and go into "free flight" section, it will offer you aircraft and location specified in "SITUATION=..."

If the location in "SITUATION=..." FLT is not on the runway, the closest runway is offered in the dialog. If the location is far from any runway, the system seems to default to Seattle Tacoma Itl.

At least those have been my obserevations...
 
I'm talking about this parameter:

[Main]
DisablePreload=1

Not sure it's properly documented anywhere
 
I'm talking about this parameter:

[Main]
DisablePreload=1

Not sure it's properly documented anywhere

Oh yes, I'm using this. All it does is prevents loading SCENERY while in UI, so that while you browse through aircraft, it doesn't give you stutters while system simultaneously loads aircraft and trying to load scenery specified in the default FLT. Documented here. However, this "saved" time will be "lost" once you commit to going into flight, as the scenery has to eventually load.

It still DOES load aircraft and location (and other parameters such as SimOnGround) from the default FLT file.
 
Back
Top