The SimConnect_RequestCameraWorldLocker function is used to set a locker in the world to load the terrain, scenery and objects around it, but only if you have acquired the camera first. This is useful if you wish to move the camera far from the user aircraft where the world data may have been unloaded from memory.

IMPORTANT!
World lockers are performance heavy, and as such should be used with care and released as soon as possible.

 

Syntax
HRESULT SimConnect_RequestCameraWorldLocker(
    HANDLE  hSimConnect,
    SIMCONNECT_DATA_XYZ lockerPosition,
    SIMCONNECT_POSITION_REFERENTIAL referential,
    DWORD objectId
    );

 

Parameters
ParameterDescriptionType
hSimConnectHandle to a SimConnect object.Integer
lockerPositionCoordinates of the locker, depending of the selected referentialSIMCONNECT_DATA_XYZ
referential

The reference used to define the lockerPosition value. One of the following:

  1. SimObject - The position is an offset from the simobject position (expressed in meters).
  2. SimObject Datum - The position is an offset from the simobject Datum Reference Point (expressed in meters).
  3. Eyepoint - The position is an offset from the aircraft pilot eyepoint (expressed in meters).
  4. World - The position is expressed using latitude, longitude, and altitude.
SIMCONNECT_POSITION_REFERENTIAL
objectId

Ignored if is referential set to World.

The object Id of the simobject that will be used to set position by SimObject, SimObject Datum and Eyepoint referential.

Set to 0 to focus user's aircraft. If the object Id is invalid, user's aircraft will be used instead.

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. If the camera locker failed to be setup, SimConnect will raise a SIMCONNECT_EXCEPTION_CAMERA_API exception to let you know that the operation failed (refer to the SIMCONNECT_EXCEPTION enum for more details).

 

Example
HANDLE  hSimConnect = NULL;
SIMCONNECT_DATA_XYZ LFPG_LLA{ 49.0083899664, 2.53844117956, 320 };
SimConnect_RequestCameraWorldLocker(hSimConnect, LFPG_LLA, SIMCONNECT_POSITION_REFERENTIAL_WORLD, 0);

 

Remarks

The sim will send a SIMCONNECT_RECV_CAMERA_WORLD_LOCKER to the client at the end of acquisition which you can use to check the camera has been properly acquired. It’s handled through SimConnect_CallDispatch.