SimConnect_CameraGet
The SimConnect_CameraGet function is used to get the current add-on camera properties, regardless of whether it has been acquired or not.
Syntax
HRESULT SimConnect_CameraGet(
HANDLE hSimConnect,
DWORD Referential
);
Parameters
| Parameter | Description | Type |
|---|---|---|
| hSimConnect | Handle to a SimConnect object. | Integer |
| Referential |
The referential to use for the camera position values (including the camera "target" position values, if used), can be one of the following
|
enum |
Return Values
The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.
| Return value | Description |
|---|---|
| S_OK | The function succeeded. |
| E_FAIL | The function failed. |
Example
Request camera data:
SimConnect_CameraGet(hSimConnect, SIMCONNECT_POSITION_REFERENTIAL_AIRCRAFT); // Request CameraGet
while (!quit)
{
SimConnect_CallDispatch(hSimConnect, MyDispatchProc, NULL);
Sleep(1);
}
The user defined dispatch function:
void CALLBACK MyDispatchProc(SIMCONNECT_RECV* pData, DWORD cbData, void* pContext)
{
switch (pData->dwID)
{
case SIMCONNECT_RECV_ID_CAMERA_DATA:
{
// Receive the coordinate of the camera
SIMCONNECT_RECV_CAMERA_DATA* pCam = (SIMCONNECT_RECV_CAMERA_DATA*)pData;
printf("\n<-Get: %f %f %f %f %f %f %f", pCam->CameraData.Pos.x, pCam->CameraData.Pos.y, pCam->CameraData.Pos.z, pCam->CameraData.Pbh.Pitch, pCam->CameraData.Pbh.Bank, pCam->CameraData.Pbh.Heading, pCam->CameraData.Fov);
break;
}
}
}
Remarks
This function will generate a SIMCONNECT_DATA_CAMERA struct which will contain all the information about the current camera, unless the camera has not been acquired, in which case a SIMCONNECT_EXCEPTION_CAMERA_API exception will be sent (see SIMCONNECT_EXCEPTION for more information).
Related Topics