• 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.

P3D v3 Simconnect and P3Dv3

gadgets

Resource contributor
Messages
9,388
Country
ca-britishcolumbia
As some of you may be aware, I've created a version of my Airfield Lights Toolbox (AFLT) that uses simobjects with attached effects controlled by Simconnect. I've emulated the Separation Plane functionality, which supports split omnis, PAPI/VASIs and approach lights and can control the on/off status of each light, supporting strobes, wigwags, etc. Everything I was doing previously with animated scenery objects I can now do with simobjects under Simconnect

The whole thing works well with FSX - but that's only useful as a stable test-bed. The overhead is substantially higher than for animated scenery objects. It also works well in P3Dv2 but, due to limitations in the way v2 handle effects, the visuals are rather poor - so I've never released it.

I had high hopes for P3Dv3. My problem is that I can't get the simobjects to spawn in P3Dv3. Simconnect is running the code OK, but every attempt to create a new light (using
AICreateSimulatedObject) results in Simconnect Exception 22 -= Create Object Failed with no further explanation. I've tried using both the v2 and V3 Simconnect dlls with the same result.

I've scoured the web looking for clues to no avail. Any suggestions would be appreciated.

Don
 
I have worked with managed code in P3d v3 - I use VS2013 and when I use:

Code:
        private void buttonMakeSnowBird_Click(object sender, EventArgs e)
        {
            SIMCONNECT_DATA_INITPOSITION Init;

            // Add a parked museum aircraft, just west of the runway

            Init.Altitude = s2.altitude;                    // Altitude
            Init.Latitude = s2.latitude + 40.0 / 6080.0/ 60.0;        // Convert
            Init.Longitude = s2.longitude + 40.0 / 6080.0/ 60.0;    // Convert
            Init.Pitch = s2.pitch * 180.0 / PI;
            Init.Bank = s2.bank * 180.0 / PI;
            Init.Heading = s2.heading * 180.0 / PI;
            Init.OnGround = 1;
            Init.Airspeed = 0;
            simconnect.AICreateSimulatedObject("Snowbirds #10", Init, DATA_REQUESTS.REQUEST_SNOWBIRD);

            displayText("Request to create objects sent...");
            //setButtons(false, false, true, true, true);

        }

This works for me. .NET 4.5, referencing LM P3D v 3.1 SDK in a C# windows forms project.

Also my livingworld program uses C++ and I have compiled it for P3D and it also works.
 
Thanks Ron. My code is equivalent to yours. The only difference (other than the value of the position variables, of course) is the OnGround flag. But 1 or 0 makes no difference on my system. So, we know its not the code (and it shouldn't be since everything works for v2). It's probably some configuration issue.

Thanks for responding. I'll keep looking.

Don
 
Problem resolved. I had set the entry in simobjects.cfg one level too low. Still a long way from having an operational AFLT in P3Dv3, but at least now I can see the lights.

Don
 
@ronh can you post your entire code plz
i can't understand the s2 struct ? where do we get it ? is it in the P3D lib already ?
thnx in advance :)
 
Have a look at the SIMCONNECT_DATA_INITPOSITION

and review the example code for Managed_AI_Waypoints
 
ok thnx
is there any way to know if scenerio is loading has finished ? cus my app tell me that it is connected even if i didn't start the scenario!
thns in advance
 
Take a moment and read through the SDK, pay particular attention to sim events. All the information you've requested is actually available in the SDK's documentation for SimConnect.
 
i searched in the simconnect variables about scenario loaded or something like that but i didn't find it
i'll keep searching :)
 
Guys just a small question
i'm not a C++ guy and i can't find how can we make a menu ( like ATC menu in P3D / that can be opened from the addons menu from the top )
to controll specefic vars
hope you help me in that thnx in advance
 
The code shouldn't be all that different though. Intellisense and some trial and error will help you get it right I believe.
 
C# is based off of C... so there's enough similarity that one should be able to discern the proper syntax differences.
 
hey
is there a way to make my application update itself without stop i mean i never stop requesting a data like position
i don't want to make a time between requests so i don't want to miss anything and for the while loop it freezes my app
any solution ? thnx in advance ( i'm a bigginer ) :)

EDIT : i found something :D : simconnect.OnRecvEventFrame
i belive this will help me
 
Last edited:
Back
Top