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

Create dynamic effect from C++ gauge?

Messages
118
Country
france
Hello,

Sorry for this probably silly question:
- Is it possible to add/retrieve an effect (Fx) dynamically from a C++ gauge ?

I would like to place in the 3D world some effects in certain conditions, so first of all I would like to know if it's possible or not :scratchch

Thanks :)

Roland
 

JB3DG

Resource contributor
Messages
1,323
Country
southafrica
Prepar3D only. But yes you can use SimConnect from within a gauge. See the ESP GDI+ gauge example.
 
Messages
118
Country
france
I did not checked it is a P3D only function :(
Is there an equivalent solution with FSX SDK?

I could perhaps replace the effect with a special cloud texture.
How clouds are depicted by Active Sky Next engine?

Thanks

Roland
 
Messages
118
Country
france
All my attempts to use SimConnect_CreateEffect() in P3D failed.
I try to create effect at the aircraft location, the call returns S_OK but nothing appears.
I checked that chosen effects are working well in FXEditor.

Did someone tried SimConnect_CreateEffect()?
Or Is it working only in P3D "Plus" client version?

Roland
 
Messages
118
Country
france
I see the second solution through the PDK: IVisualEffectManager
And more simple, without need of callback.

I hope to be lucky this time :)

Hum, only available in version 2.5... unlucky
 
Last edited:

JB3DG

Resource contributor
Messages
1,323
Country
southafrica
Wish I could help you more....I simply haven't had the chance to delve that deep yet though.
 
Messages
118
Country
france
Actually I'm able to call SimConnect_CreateEffect() with visible success if I set TRUE to the 4th parameter which requests it to be attached to the aircraft.
Then I guess the problem is about world coordinates references. I probably create the effect somewhere else in the world.

The LM SDK is not much detailled on the Lat/Lon world reference, it only says the unit is "radians" for both.

In my code I retrieve the aircraft lat/lon from simConnect:

My data struct is
Code:
struct NavData
{
  double  heading;
   double lat, lon, alt;
};

Code:
case SIMCONNECT_RECV_ID_OPEN:
        SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_NAV_DATA, "PLANE HEADING DEGREES TRUE", "radians");
        SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_NAV_DATA, "PLANE LATITUDE", "radians");
         SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_NAV_DATA, "PLANE LONGITUDE", "radians");
         SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_NAV_DATA, "PLANE ALTITUDE", "feet");

Then collect current data
Code:
case SIMCONNECT_RECV_ID_SIMOBJECT_DATA:

        SIMCONNECT_RECV_SIMOBJECT_DATA *pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA*) pData;

        switch(pObjData->dwRequestID)
         {
           case REQUEST_NAV_DATA:
             SimConnectData->NavData = (NavData*)&pObjData->dwData;
             break;
         }

Then I use the coordinates directly to create effect, without computation, so it's supposed to appear at aircraft location (or near).

It would mean the world reference is different between what I receive from SimConnect callback and what is expected in SimConnect_CreateEffect() ?

Which conversion am I supposed to do?

Roland
 
Messages
118
Country
france
Writing the above post I realize it may be radians at the source and degrees for the effect!
Let's try...
 
Messages
118
Country
france
That was it.
With the conversion
Code:
                        SimConnectData->pos.Latitude = (double)((double)SimConnectData->NavData->lat * (double)(180.0 / M_PI));
                        SimConnectData->pos.Longitude = (double)((double)SimConnectData->NavData->lon * (double)(180.0 / M_PI));

It works fine
 
Top