---
name: "BIS_fnc_dirTo"
type: function
status: ok
groups: ["Geometry"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_dirTo
revid: 327975
updated: 2022-07-13T14:37:05Z
---

# BIS_fnc_dirTo

*Function · Geometry · Arma 3 v0.50 · introduced in Arma 2 v1.00*

## Description

Function which returns vector direction from pos1 to pos2.

> [!NOTE]
> **Arma 3:** Use `obj1 getDir obj2` instead of [BIS_fnc_dirTo](../functions/BIS_fnc_dirTo.md).

## Syntax

```sqf
[param1, param2] call BIS_fnc_dirTo
```

**Parameters:**

- `param1` - vector starting point, [Position](../topics/Position.md) **or** [Object](../topics/Object.md)
- `param2` - vector ending point, [Position](../topics/Position.md) **or** [Object](../topics/Object.md)

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

## Examples

### Example 1

sets unit1 in the direction of unit2

```sqf
unit1 setDir ([unit1, unit2] call BIS_fnc_dirTo);
```

## See also

[getDir](../commands/getDir.md) · [setDir](../commands/setDir.md)

## Community notes

**AgentRev** — 2015-01-21

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

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

```sqf
[0,1,0], -([_unit, _vehicle] call BIS_fnc_dirTo)] call BIS_fnc_rotateVector2D;
```

<sub>Source: [BI Community Wiki — BIS fnc dirTo](https://community.bistudio.com/wiki/BIS_fnc_dirTo) (revision 327975).</sub>
