---
name: "BIS_fnc_vectorFromXToY"
type: function
status: ok
groups: ["Vectors"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_vectorFromXToY
revid: 352158
updated: 2024-02-01T23:25:22Z
---

# BIS_fnc_vectorFromXToY

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

## Description

Returns a unit vector that 'points' from *vector1* to *vector2*.
This is a very useful function as it can be used with the [velocity](../commands/velocity.md) command to move an object from one position to another (i.e *vector1* to *vector2*).

> [!NOTE]
> Ensure both positions are found using [getPosASL](../commands/getPosASL.md).

> [!NOTE]
> **Arma 3:** Since Arma 3 v1.26 For better performance, use the [vectorFromTo](../commands/vectorFromTo.md) command instead.

## Syntax

```sqf
[vector1, vector2] call BIS_fnc_vectorFromXToY
```

**Parameters:**

- `vector1`: [Array](../topics/Array.md)
- `vector2`: [Array](../topics/Array.md)

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

## Examples

### Example 1

```sqf
private _resultVector = [getPosASL vehicle player, getPosASL airTarget] call BIS_fnc_vectorFromXToY;
```

## See also

[velocity](../commands/velocity.md) · [setVelocity](../commands/setVelocity.md) · [vectorAdd](../commands/vectorAdd.md)

<sub>Source: [BI Community Wiki — BIS fnc vectorFromXToY](https://community.bistudio.com/wiki/BIS_fnc_vectorFromXToY) (revision 352158).</sub>
