---
name: "setVectorDir"
type: command
status: ok
groups: ["Math - Vectors"]
arma3_since: "0.50"
locality: {"argument": "local", "effect": "global", "server_exec": false}
source: https://community.bistudio.com/wiki/setVectorDir
revid: 377248
updated: 2026-01-02T05:42:47Z
---

# setVectorDir

*Command · Math - Vectors · Arma 3 v0.50 · introduced in Operation Flashpoint: Elite v1.00*

Locality: arguments **local** · effect **global**

## Description

Set object's direction vector. Up vector will remain unchanged.

## Syntax

```sqf
object setVectorDir vectorDir
```

**Parameters:**

- `object`: [Object](../topics/Object.md)
- `vectorDir`: [Vector3D](../topics/Vector3D.md)

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

## Examples

### Example 1

```sqf
player setVectorDir [5,6,1];
```

### Example 2

```sqf
// provided _myMine is local
_myMine setVectorDir [0.3, 1, 0];
_myMine setPosWorld getPosWorld _myMine; // synchronises the mine's direction over the network (special case)
```

## Problems

The effect is Local Effect when using [setVectorDir](../commands/setVectorDir.md) on a mine. Use a position modification to broadcast [setVectorDir](../commands/setVectorDir.md)'s change (see [#Example 2](../commands/setVectorDir.md#example-2)).

## See also

[vectorDir](../commands/vectorDir.md) · [vectorUp](../commands/vectorUp.md) · [setVectorUp](../commands/setVectorUp.md) · [setVectorDirAndUp](../commands/setVectorDirAndUp.md) · [vectorDiff](../commands/vectorDiff.md) · [vectorAdd](../commands/vectorAdd.md) · [vectorMultiply](../commands/vectorMultiply.md) · [vectorCrossProduct](../commands/vectorCrossProduct.md) · [vectorDistance](../commands/vectorDistance.md) · [vectorMagnitudeSqr](../commands/vectorMagnitudeSqr.md) · [vectorDistanceSqr](../commands/vectorDistanceSqr.md) · [vectorCos](../commands/vectorCos.md) · [vectorMagnitude](../commands/vectorMagnitude.md) · [vectorDotProduct](../commands/vectorDotProduct.md) · [vectorNormalized](../commands/vectorNormalized.md) · [vectorFromTo](../commands/vectorFromTo.md)

## Community notes

**Str** — 2008-03-16

Command can be also used to rotate camera in all three axis.

---

**General Barron** — 2009-03-03

[setVectorDir](../commands/setVectorDir.md) can only influence an object's pitch. It can not influence bank. Example:

```sqf
player setVectorDir [0,0,1];
```

- If the player is facing 0 degrees (north), then this will do NOTHING.
- If the player is facing 90 degrees (east), then this will make him pitch 90 degrees up.
You can't directly pitch an object beyond 90 degrees, because this would change its facing direction. You must first flip it is direction using setDir, then you must bank the object 180 degrees, THEN you pitch the object appropriately.

---

**DreadedEntity** — 2015-08-17

In Arma 3, [setVectorDir](../commands/setVectorDir.md) does not control an object's pitch or bank, in fact, it is not possible to change either of those solely using [setVectorDir](../commands/setVectorDir.md). This command can only affect horizontal rotation along the x-plane, unless an object first has it is [vectorUp](../commands/vectorUp.md) changed to something other than [0,0,1]. Correct input to [setVectorDir](../commands/setVectorDir.md) should be calculated using the trigonometric functions [sin](../commands/sin.md) and [cos](../commands/cos.md).

examples:

```sqf
// 0 degrees (north)
player setVectorDir
[
    sin 0, // equals 0
    cos 0, // equals 1
    1
];
// 45 degrees (north-east)
player setVectorDir
[
    sin 45, // equals 0.707
    cos 45, // equals 0.707
    1
];
```

If you are doing trigonometric calculations, it may be better to use [setVectorDir](../commands/setVectorDir.md) rather than [setDir](../commands/setDir.md), since sine and cosine have already been calculated and will not need to be re-calculated
(also, [setDir](../commands/setDir.md) probably uses [setVectorDir](../commands/setVectorDir.md) anyway.)

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