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

MSFS20 ACCESSING POV DATA IN MSFS 2020

Messages
162
Country
italy
This piece of code:
Code:
bool Gunsight::InitEyePoint(void) {
    HRESULT hr = S_FALSE;
    if(this->hSimConnect == (HANDLE) NULL)
        this->hSimConnect = GetConnection();
    if (this->hSimConnect) {
        hr = SimConnect_AddToDataDefinition(this->hSimConnect, DEFINITION_EYEPOINT_ANGLE,
            "STRUCT EYEPOINT DYNAMIC ANGLE", "radians",  SIMCONNECT_DATATYPE_XYZ, 0, SIMCONNECT_UNUSED);
        if (hr == S_OK)
            hr = SimConnect_AddToDataDefinition(this->hSimConnect, DEFINITION_EYEPOINT_OFFSET,
                "STRUCT EYEPOINT DYNAMIC OFFSET", "feet",  SIMCONNECT_DATATYPE_XYZ, 0, SIMCONNECT_UNUSED);
        if(hr == S_OK)
            hr = SimConnect_AddToDataDefinition(this->hSimConnect, DEFINITION_EYEPOINT_POSITION,
                "EYEPOINT POSITION", "feet",  SIMCONNECT_DATATYPE_XYZ, 0, SIMCONNECT_UNUSED);
        if (hr == S_OK)
            hr = SimConnect_RequestDataOnSimObject(hSimConnect,
                EYEPOINT_ANGLE_REQUEST, DEFINITION_EYEPOINT_ANGLE, SIMCONNECT_OBJECT_ID_USER, GUNSIGHT_EYEPOINT_REFRESH);
        if (hr == S_OK)
            hr = SimConnect_RequestDataOnSimObject(hSimConnect,  EYEPOINT_OFFSET_REQUEST, DEFINITION_EYEPOINT_OFFSET,
                SIMCONNECT_OBJECT_ID_USER, GUNSIGHT_EYEPOINT_REFRESH);
        if (hr == S_OK)
            hr = SimConnect_RequestDataOnSimObject(hSimConnect,  EYEPOINT_POSITION_REQUEST, DEFINITION_EYEPOINT_POSITION,
                SIMCONNECT_OBJECT_ID_USER, GUNSIGHT_EYEPOINT_REFRESH);
    }
    return hr == S_OK;
}
and the msg queue part:
Code:
             /*
             * POV answers with void struct
             * collimating gunsight almost impossible
             */
             case EYEPOINT_ANGLE_REQUEST:
             {
                 SIMCONNECT_DATA_XYZ* angle = (SIMCONNECT_DATA_XYZ*)&pObjData->dwData;
                  memcpy( &myGunsight->pov_Angle, angle, sizeof(SIMCONNECT_DATA_XYZ));
                  myGunsight->CollimateAngle();
             }
             break;
             case EYEPOINT_POSITION_REQUEST:
             {
                 SIMCONNECT_DATA_XYZ* position = (SIMCONNECT_DATA_XYZ*)&pObjData->dwData;
                 memcpy(&myGunsight->pov_Position, position, sizeof(SIMCONNECT_DATA_XYZ));
                 myGunsight->CollimateOffset()
              }
            break;
            case EYEPOINT_OFFSET_REQUEST:
             {
                 SIMCONNECT_DATA_XYZ* offset = (SIMCONNECT_DATA_XYZ*)&pObjData->dwData;
                 memcpy(&myGunsight->pov_Angle, offset, sizeof(SIMCONNECT_DATA_XYZ));
                 myGunsight->CollimateOffset();
               }
             break;
Code works correctly but as were on FSX/P3D returned data struct are void.
SDK reports on SimConnect::SimConnect status of Simulation variables:
Code:
STRUCT EYEPOINT DYNAMIC ANGLE     SIMCONNECT_DATA_XYZ     N  Responded        
STRUCT EYEPOINT DYNAMIC OFFSET   SIMCONNECT_DATA_XYZ     N   Responded        
EYEPOINT POSITION     SIMCONNECT_DATA_XYZ     N    Responded
this makes a collimated gunsight almost impossible.
any ideas ?
tia
/Mario
 
Responded doesn't mean it works, just means you get a response.
yeah, a bad useless response :)
BTW:
"responded" is written on almost all reported variables, so what means ?
For me it means that who wrote the SDK most probably did not know nothing about wath was writing.
 
Last edited:
Do you expect to get both eyepoints for VR scenario and make two different images? I'm curious to know how default 787 HUD works in VR. I think that awesome graphics engine of MSFS have build in settings for gunsight and modern HUD, just need to wait for proper SDK documentation.
 
Last edited:
Do you expect to get both eyepoints for VR scenario and make two different images? I'm curious to know how default 787 HUD works in VR. I think that awesome graphics engine of MSFS have build in settings for gunsight and modern HUD, just need to wait for proper SDK documentation.
yes, i hope so too.
/Mario
 
Back
Top