XPLMCamera
Control X-Plane's camera angle and position. Register a per-frame callback that supplies a 6-DOF camera pose (OpenGL local coordinates + pitch/roll/yaw).
Enumerations
XPLMCameraControlDuration
This enumeration states how long you want to retain control of the camera. You can retain it indefinitely or until the user selects a new view.
| Constant | Value | Description |
|---|---|---|
xplm_ControlCameraUntilViewChanges |
1 |
Control the camera until the user picks a new view. |
xplm_ControlCameraForever |
2 |
Control the camera until your plugin is disabled or another plugin forcibly takes control. |
Functions
XLuaControlCamera(howLong, callback, refcon)
Returns: (returns nothing)
This function repositions the camera on the next drawing cycle. You must pass a non-null control function. Specify in inHowLong how long you'd like control (indefinitely or until a new view mode is set by the user).
| Argument | Type | Notes |
|---|---|---|
howLong |
XPLMCameraControlDuration |
Enum — use a constant from XPLMCameraControlDuration |
controlFunc |
function |
Callback — a Lua function you define |
refcon |
any |
Any Lua value; passed through to your callback unchanged |
XLuaDontControlCamera()
Returns: (returns nothing)
This function stops you from controlling the camera. If you have a camera control function, it will not be called with an inIsLosingControl flag. X-Plane will control the camera on the next cycle. For maximum compatibility you should not use this routine unless you are in posession of the camera.
XLuaIsCameraBeingControlled()
Returns: boolean, {k} with keys: cameraControlDuration
This routine returns true if the camera is being controlled, false if it is not. If it is and you pass in a pointer to a camera control duration, the current control duration will be returned.
Output table keys:
| Key | Type |
|---|---|
cameraControlDuration |
number |
XLuaReadCameraPosition()
Returns: {k} with keys: cameraPosition
This function reads the current camera position.
Output table keys:
| Key | Type |
|---|---|
cameraPosition |
{k} |
Examples
Examples coming soon.