The SimConnect_CameraSet function is used to set the properties of the camera. This function can only be used when the add-on camera has been acquired.

 

Syntax
HRESULT SimConnect_CameraSet(
    HANDLE hSimConnect,
    SIMCONNECT_DATA_CAMERA CameraData,
    DWORD DataMask
    );

 

Parameters
ParameterDescriptionType
hSimConnectHandle to a SimConnect object.Integer
CameraDataThis is a SIMCONNECT_DATA_CAMERA struct containing the member parameters you wish to set. The parameters should correspond to the DataMask used.Struct
DataMaskThis is a bitmask that can be created using the SIMCONNECT_CAMERA_DATA_MASK enum members, and defines which parts of the CameraData struct should be used for the camera.Integer

 

Return Values

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return valueDescription
S_OKThe function succeeded.
E_FAILThe function failed.

 

Example

Set camera data:

SIMCONNECT_DATA_CAMERA data;
data.PositionReferential = SIMCONNECT_POSITION_REFERENTIAL_SIMOBJECT;
data.PositionReferentialObjectId = 0;        
data.Position.z =-10.0;
data.Position.x = 0;
data.Position.y = 4.0;
data.RotationReferential = SIMCONNECT_POSITION_REFERENTIAL_SIMOBJECT;
data.RotationReferentialObjectId = 0; 
data.Pbh.Pitch = 0;
data.Pbh.Bank = 0;
data.Pbh.Heading = 0;
data.Fov = 0.80;
SimConnect_CameraSet(hSimConnect, data, SIMCONNECT_CAMERA_DATA_MASK_ALL_ROTATION);

 

Remarks

Note that if the add-on camera has not been acquired previously, then a SIMCONNECT_EXCEPTION_CAMERA_API exception will be sent (see SIMCONNECT_EXCEPTION for more information).