---
name: "lockCameraTo"
type: command
status: ok
groups: ["Camera Control"]
arma3_since: "1.26"
locality: {"argument": "local", "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/lockCameraTo
revid: 377889
updated: 2026-01-05T17:33:18Z
---

# lockCameraTo

*Command · Camera Control · Arma 3 v1.26*

Locality: arguments **local**

## Description

Lock/Unlock stabilized camera to target. Works only on turrets which have optic mode selected with [direction stabilization enabled](../commands/directionStabilizationEnabled.md).

> [!NOTE]
> Since Arma 3 v2.08 the command also works with non-stabilized turrets (such as main turret of a tank). See [syntax 2](../commands/lockCameraTo.md#alternative_syntax).

> [!NOTE]
> The command is local to the **turret** gunner, not the vehicle.

## Syntax

### Syntax 1

```sqf
vehicle lockCameraTo [target, turretPath]
```

**Parameters:**

- `vehicle`: [Object](../topics/Object.md) - UAV
- `target`: [Object](../topics/Object.md) or [PositionASL](../topics/Position.md#positionasl) - use [objNull](../commands/objNull.md) to unlock
- `turretPath`: Turret Path - path to the turret with required camera

**Returns:** [Nothing](../topics/Nothing.md)

> [!IMPORTANT]
> - This syntax only works with stabilized turrets.
> - When using this syntax, if target is out of possible view, the turret will move to its limit and get stuck there, with blocked input.

### Syntax 2

*since arma3 2.08*

```sqf
vehicle lockCameraTo [target, turretPath, temporary]
```

**Parameters:**

- `vehicle`: [Object](../topics/Object.md) - UAV
- `target`: [Object](../topics/Object.md) or [PositionASL](../topics/Position.md#positionasl) - use [objNull](../commands/objNull.md) to unlock
- `turretPath`: Turret Path - path to the turret with required camera
- `temporary`: [Boolean](../topics/Boolean.md) - if set to [true](../commands/true.md), the engine will automatically remove the lock-on once the turret reaches its target.
  If the target is out of turret's reach, once the turret reaches its [limits](../commands/getTurretLimits.md) the lock-on will be released.

**Returns:** [Nothing](../topics/Nothing.md)

> [!NOTE]
> This syntax also works with non-stabilized turrets, unlike [#Syntax 1](../commands/lockCameraTo.md#syntax-1).

## Examples

### Example 1

```sqf
uav lockCameraTo [cursorObject, [0,0]];
```

### Example 2

```sqf
uav lockCameraTo [objNull, [0,0]]; // unlocks the turret
```

### Example 3

```sqf
vehicle player lockCameraTo [enemyTarget, vehicle player unitTurret player, false];
```

## See also

[lockedCameraTo](../commands/lockedCameraTo.md) · [camTarget](../commands/camTarget.md) · [camSetTarget](../commands/camSetTarget.md) · [camPrepareTarget](../commands/camPrepareTarget.md) · [directionStabilizationEnabled](../commands/directionStabilizationEnabled.md) · [enableDirectionStabilization](../commands/enableDirectionStabilization.md)

## Community notes

**Commy2** — 2015-04-10

The vehicle has to have a stabilized optic for this command to work with ASL position.

<sub>Source: [BI Community Wiki — lockCameraTo](https://community.bistudio.com/wiki/lockCameraTo) (revision 377889).</sub>
