P3D v3 Simconnect and P3Dv3

gadgets

Resource contributor
#1
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
 
#2
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.
 

gadgets

Resource contributor
#3
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
 

gadgets

Resource contributor
#4
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
 
#7
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
 
#8
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.
 
#10
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
 

JB3DG

Resource contributor
#14
The code shouldn't be all that different though. Intellisense and some trial and error will help you get it right I believe.
 
#16
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:
Top