---
name: "Camera Tutorial"
type: topic
source: https://community.bistudio.com/wiki/Camera_Tutorial
revid: 370868
updated: 2025-02-21T10:43:59Z
---

# Camera Tutorial

### Basics

A cinematic camera is what is commonly known as a "cutscene"; the player's input are dismissed and events happen during the video.\
A camera is **[local](../topics/Multiplayer_Scripting.md#locality)** to the computer where the script has been called; one player could see a cutscene but still get killed by another player that didn't trigger the video.

### How to

The list of all camera commands can be found in the Camera command group category.

> [!IMPORTANT]
> The "Prepare" version of camera commands has been introduced with Armed Assault. Using this set of commands helps the engine preloading the camera's (future) field of view (see also [preloadCamera](../commands/preloadCamera.md)).\
> **Operation Flashpoint** only features the "Set" version of camera commands; use them instead (e.g [camPreparePos](../commands/camPreparePos.md) becomes [camSetPos](../commands/camSetPos.md), [camCommitPrepared](../commands/camCommitPrepared.md) becomes [camCommit](../commands/camCommit.md), etc).\
> Only [camCommitted](../commands/camCommitted.md) is common to both syntaxes.

#### Create the camera

```sqf
private _camera = "camera" camCreate getPosATL player;
```

#### Enter the camera

```sqf
_camera cameraEffect ["internal", "back"];
```

#### Select a target

##### Object target

```sqf
_camera camPrepareTarget player; // a camera will automatically target the human target's face
```

##### Position target

```sqf
_camera camPrepareTarget getPosATL player;
```

#### Place the camera

##### World position

```sqf
_camera camPreparePos (player getRelPos [5, 0]);
```

##### Relative position

```sqf
_camera camCommitPrepared 0; // required to apply the prepared target first - otherwise a long trip from [0,0,0] is to follow
_camera camPrepareRelPos [0,5,0];
```

#### Apply camera's Field of View

```sqf
_camera camPrepareFOV 0.5; // standard FOV is 0.7; lesser (e.g 0.5) is zoomed in, greater (e.g 0.9) is zoomed out
```

#### Apply all the changes

##### Immediately or with transition

```sqf
_camera camCommitPrepared 0; // 0 for immediate change, value in seconds for transition
```

##### With a loading timeout

```sqf
_camera camPreload 3;    // since Armed Assault - instantly moves the camera once preload or timeout is done.
                        // tells the game to preload the future field of view. 3 here is a timeout, 0 for infinite timeout
```

#### Check that the commit happened

```sqf
camCommitted _camera; // for camCommit/camCommitPrepared usage
```

```sqf
camPreloaded _camera; // for camPreload usage
```

#### Leave the camera

```sqf
_camera cameraEffect ["terminate", "back"];
```

#### Delete the camera

```sqf
camDestroy _camera;
```

### Specific cases

- A camera of bird type (seagull or crowe) **cannot** be controlled via "Prepare" commands - only camSet* ones.
- A camera of bird type is **always** committed ([camCommitted](../commands/camCommitted.md) will always return [true](../commands/true.md)) even if it is still moving toward its destination.

### Full example

| [SQF Syntax](../topics/SQF_Syntax.md) | [SQS Syntax](../topics/SQS_Syntax.md) |
|---|---|
| ```sqf<br>private _camera = "camera" camCreate [0, 0, 0];<br>_camera camPrepareTarget player;<br>_camera camCommitPrepared 0; // needed for relative position<br>_camera camPrepareRelPos [0, -5, 10];<br>_camera cameraEffect ["internal", "back"];<br>_camera camCommitPrepared 0;<br>waitUntil { camCommitted _camera };<br>_camera camPrepareRelPos [90, 25, 8];<br>_camera camCommitPrepared 5;<br>waitUntil { camCommitted _camera };<br>_camera camPrepareRelPos [-90, -5, 5];<br>_camera camCommitPrepared 3;<br>waitUntil { camCommitted _camera };<br>sleep 3;<br>_camera cameraEffect ["terminate", "back"];<br>camDestroy _camera;<br>``` | ```sqs<br>_camera = "camera" camCreate [0, 0, 0]<br>_camera camSetTarget player<br>_camera camSetRelPos [0, -5, 10]<br>_camera cameraEffect ["internal", "back"]<br>_camera camCommit 0<br>@camCommitted _camera<br>_camera camSetRelPos [90, 25, 8]<br>_camera camCommit 5<br>@camCommitted _camera<br>_camera camSetRelPos [-90, -5, 5]<br>_camera camCommit 3<br>@camCommitted _camera<br>~3<br>_camera cameraEffect ["terminate", "back"]<br>camDestroy _camera<br>``` |

### Picture-in-Picture

#### Create Source

The Picture-in-Picture (PiP) RTT (or R2T, Render to Texture) source can be defined at the [Enter the camera](../topics/Camera_Tutorial.md#enter-the-camera) step; instead of

```sqf
_camera cameraEffect ["internal", "back"];
```

use the following to create a PiP source - multiple sources can be

```sqf
_camera cameraEffect ["internal", "back", "rttName"];
```

#### Configure PiP Effects

A camera effect is set using [setPiPEffect](../commands/setPiPEffect.md) as such:

```sqf
"rttName" setPiPEffect [2]; // sets thermal imaging
```

Once all the configuration is done, the PiP texture can be accessed by referencing its name "rttName". For example:

```sqf
if (!isPiPEnabled) exitWith { systemChat "PiP is not enabled in video options"; };

with uiNamespace do // or use disableSerialization
{
    private _ctrl = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscPicture", -1];
    _ctrl ctrlSetPosition [safeZoneW * 0.75, safeZoneY, safeZoneW * 0.25, safeZoneH * 0.25];
    _ctrl ctrlSetText "#(argb,512,512,1)r2t(rttName,1.0)";
    _ctrl ctrlCommit 0;
};
```

In order to stop the camera from "broadcasting", use

```sqf
_camera cameraEffect ["terminate", "back", "rttName"];    // terminates "rttName" r2t source
_camera cameraEffect ["terminate", "back"];                // terminates all r2t source
```

The camera still exists until destroyed with [camDestroy](../commands/camDestroy.md).

### See also

- Camera.sqs
- [Arma 3: Splendid Camera](../topics/Splendid_Camera.md) / [BIS_fnc_camera](../functions/BIS_fnc_camera.md)
- Command Group: Camera Control
- [BIS_fnc_PIP](../functions/BIS_fnc_PIP.md)

<sub>Source: [BI Community Wiki — Camera Tutorial](https://community.bistudio.com/wiki/Camera_Tutorial) (revision 370868).</sub>
