FCS Targeting and DIS entities

MicMac44
Posts: 21
Joined: Fri Feb 15, 2019 5:48 pm

FCS Targeting and DIS entities

Postby MicMac44 » Fri Oct 25, 2019 6:40 pm

Using the in-game "Weapons Gauge" window, I am able to target DIS entities. With that, it also looks like the sim is grabbing relevant spatial information about that DIS entity (LLA to calculate distance and altitude, etc...).

When I try to use the SDK to access FCS information, it seems like DIS entities do not appear. Is there a way to access the ObjectID of that DIS Entity? I am trying to use the PDK to draw a line and some other relevant information for the user.

Example code snippet:

Code: Select all

enum EVENT_ID { EVENT_RECUR_1SEC, EVENT_NEXT_TARGET, }; enum DATA_DEFINE_ID { DEFINITION_FCS, }; enum DATA_REQUEST_ID { REQUEST_FCS, }; struct Struct1 { int numTargets; }; void CALLBACK MyDispatchProc(SIMCONNECT_RECV* pData, DWORD cbData, void* pContext) { HRESULT hr; switch (pData->dwID) { case SIMCONNECT_RECV_ID_SIMOBJECT_DATA: { SIMCONNECT_RECV_SIMOBJECT_DATA* pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA*)pData; switch (pObjData->dwRequestID) { case REQUEST_FCS: Struct1* pS = (Struct1*)&pObjData->dwData; printf("Number of targets: %i", pS->numTargets); break; } break; } default: printf("\nMissed the case\n"); break; } } HANDLE mSimConnect; void StartSimConnect() { int quit = 0; if (SUCCEEDED(SimConnect_Open(&mSimConnect, ("DIS_Testing"), NULL, 0, NULL, 0))) { SimConnect_AddToDataDefinition(mSimConnect, DEFINITION_FCS, "FCS TARGET LIST COUNT", "number"); SimConnect_RequestDataOnSimObject(mSimConnect, REQUEST_FCS, DEFINITION_FCS, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_SECOND); SimConnect_CallDispatch(mSimConnect, MyDispatchProc, NULL); if (quit == 1) { SimConnect_Close(mSimConnect); } } else { printf("\nCouldnt open simconnect\n"); } }
Even though I can target the DIS Entity with the "Weapons Gauge", this is outputting that I have a target count of 0.

User avatar
Brady Butler
Lockheed Martin
Posts: 965
Joined: Tue May 09, 2017 5:31 pm

Re: FCS Targeting and DIS entities

Postby Brady Butler » Fri Oct 25, 2019 6:51 pm

Hello,

I believe you may be looking for GetEntityIdByObjectId() (or GetObjectIdByEntityId()) which can be found here:

https://www.prepar3d.com/SDKv4/sdk/pdk_ ... 6a41e91f21

Regards,
Brady
Brady Butler
Prepar3D® Software Engineer


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: Baidu [Spider] and 14 guests