---
name: "vectorAdd"
type: command
status: ok
groups: ["Math - Vectors"]
arma3_since: "1.22"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/vectorAdd
revid: 378392
updated: 2026-04-04T07:53:40Z
---

# vectorAdd

*Command · Math - Vectors · Arma 3 v1.22*

## Description

Adds two arrays of numbers. Replaces [BIS_fnc_vectorAdd](../functions/BIS_fnc_vectorAdd.md).

> [!NOTE]
> **Since Arma 3 v2.14:** Since Arma 3 v2.14 any count of numbers is valid, if one array is larger than the other, the remaining elements are inserted without change.
>
> Before Arma 3 v2.14, the first argument had to be vector 3D, or Arma 3 v2.00 2D (Which still returned 3D result, with z coordinate defaulted to 0)

## Syntax

```sqf
vector1 vectorAdd vector2
```

**Parameters:**

- `vector1`: [Array](../topics/Array.md) of [Number](../topics/Number.md)s - can be any size
- `vector2`: [Array](../topics/Array.md) of [Number](../topics/Number.md)s - can be any size

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

## Examples

### Example 1

```sqf
hint str (velocity unit1 vectorAdd velocity unit2);
```

### Example 2

```sqf
[5, 10, 5] vectorAdd [5, 5, 10];            // returns [10, 15, 15]
```

### Example 3

```sqf
[0, 0] vectorAdd [1, -2];                    // returns [1, -2]
```

### Example 4

```sqf
[1, 2, 3, 4, 5, 6] vectorAdd [10, 10, 10];    // returns [11, 12, 13, 4, 5, 6]
```

### Example 5

```sqf
[1, 2, 3] vectorAdd [1, 2, 3];    // [2, 4, 6]
[1, 2, 3] vectorAdd [1, 2];        // [2, 4, 3]
[1, 2] vectorAdd [1, 2, 3];        // [2, 4, 3]
[1, 2] vectorAdd [1, 2];        // [2, 4]
```

## See also

[vectorDiff](../commands/vectorDiff.md) · [vectorCrossProduct](../commands/vectorCrossProduct.md) · [vectorDotProduct](../commands/vectorDotProduct.md) · [vectorCos](../commands/vectorCos.md) · [vectorMagnitude](../commands/vectorMagnitude.md) · [vectorMagnitudeSqr](../commands/vectorMagnitudeSqr.md) · [vectorMultiply](../commands/vectorMultiply.md) · [vectorDistance](../commands/vectorDistance.md) · [vectorDistanceSqr](../commands/vectorDistanceSqr.md) · [vectorDir](../commands/vectorDir.md) · [vectorUp](../commands/vectorUp.md) · [setVectorDir](../commands/setVectorDir.md) · [setVectorUp](../commands/setVectorUp.md) · [setVectorDirAndUp](../commands/setVectorDirAndUp.md) · [matrixMultiply](../commands/matrixMultiply.md) · [matrixTranspose](../commands/matrixTranspose.md)

## Community notes

**Lou Montana** — 2023-11-02

```sqf
// between Arma 3 v2.00 and Arma 3 v2.14:
[1, 2] vectorAdd [1, 2]; // [2, 4, 0]
```

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