Arma 3 Scripting

Command in Math - Vectors

vectorMagnitude

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

Description

Magnitude of a 3D vector.

Note

Since Arma 3 v2.14: Since Arma 3 v2.14 any count of numbers is valid.

Before Arma 3 v2.14, the argument had to be vector 3D, or Arma 3 v2.00 2D (With z coordinate defaulted to 0)

Syntax

vectorMagnitude vector

Parameters:

Returns: Number

Examples

Example 1

_size = vectorMagnitude [0,3,4]; // returns 5

Example 2

_speed = vectorMagnitude velocity player;                // return velocity of player in m/s
_speed = (vectorMagnitude velocity player) * 3.6;        // return velocity of player in km/h
_speed = (vectorMagnitude velocity player) * 2.23694;    // return velocity of player in mph

See also

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