---
name: "getDir"
type: command
status: ok
groups: ["Object Manipulation"]
arma3_since: "0.50"
locality: {"argument": "global", "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/getDir
revid: 364132
updated: 2024-05-04T22:14:16Z
---

# getDir

*Command · Object Manipulation · Arma 3 v0.50 · introduced in Operation Flashpoint v1.00*

Locality: arguments **global**

## Description

Returns the object heading in the range 0..360.

> [!NOTE]
> **Arma 3:** The alternative syntax gets heading from one object or position to another object or position, and should be used instead of [BIS_fnc_dirTo](../functions/BIS_fnc_dirTo.md).

## Syntax

### Syntax 1

```sqf
getDir object
```

**Parameters:**

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

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

### Syntax 2

*since arma3 1.56*

```sqf
pos1 getDir pos2
```

**Parameters:**

- `pos1`: [Object](../topics/Object.md), [Position2D](../topics/Position.md#introduction) or [Position3D](../topics/Position.md#introduction) - from where
- `pos2`: [Object](../topics/Object.md), [Position2D](../topics/Position.md#introduction) or [Position3D](../topics/Position.md#introduction) - to where

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

## Examples

### Example 1

```sqf
_azimuth = getDir player;
```

### Example 2

```sqf
_azimuth = player getDir tank;
```

## See also

[getDirVisual](../commands/getDirVisual.md) · [direction](../commands/direction.md) · [getRelDir](../commands/getRelDir.md)

## Community notes

**AgentRev01** — 2013-10-23

Be careful when using this command in conjunction with [BIS_fnc_rotateVector2D](../functions/BIS_fnc_rotateVector2D.md), which rotates vectors counterclockwise as per trigonometric conventions, while [getDir](../commands/getDir.md) returns a clockwise angle.

To counter this, simply negate the output of [getDir](../commands/getDir.md):

```sqf
[[0,1,0], -(getDir _object)] call BIS_fnc_rotateVector2D;
```

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