Arma 3 Scripting

Command in Math - Vectors

vectorDiff

Also available as Markdown and JSON, or read the original wiki page.

Description

Subtracts one 3D vector from another. (vector1 - vector2)

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

vector1 vectorDiff vector2

Parameters:

Returns: Array of Numbers

Examples

Example 1

hint str (velocity car vectorDiff velocity bike);

See also

vectorAdd · vectorCrossProduct · vectorDotProduct · vectorCos · vectorMagnitude · vectorMagnitudeSqr · vectorMultiply · vectorDistance · vectorDistanceSqr · vectorDir · vectorUp · setVectorDir · setVectorUp · setVectorDirAndUp · vectorNormalized · vectorFromTo

Community notes

ffur2007slx2_5

Arma 3 v1.22 Algorithm:

Vector1 = [x1,y1,z1]; Vector2 = [x2,y2,z2];
Result = [x1 - x2, y1 - y2, z1 - z2];

It is recommended to use vectorDiff instead of BIS_fnc_vectorDiff.