vectorNormalized

From Bohemia Interactive Community
Revision as of 15:56, 6 January 2026 by Lou Montana (talk | contribs) (Some wiki formatting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Hover & click on the images for description

Description

Description:
Returns normalised vector (unit vector, vectorMagnitude == 1) of given vector. If given vector is 0 result is a 0 vector as well.
Groups:
Math - Vectors

Syntax

Syntax:
vectorNormalized vector
Parameters:
vector: Array of Numbers
Return Value:
Array format Vector3D

Examples

Example 1:
vectorNormalized [12345,7890,38383]; // [0.300481,0.192045,0.934254] vectorMagnitude [0.300481,0.192045,0.934254]; // 1

Additional Information

See also:
vectorDiff vectorCrossProduct vectorDotProduct vectorCos vectorMagnitude vectorMagnitudeSqr vectorMultiply vectorDistance vectorDistanceSqr vectorDir vectorUp setVectorDir setVectorUp setVectorDirAndUp vectorFromTo matrixMultiply matrixTranspose

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note
ffur2007slx2_5 - c
Posted on Jul 19, 2014 - 15:13 (UTC)
Arma 3 logo black.png 1.26 Algorithm:
_vector = [x,y,z]; _result = [x / (sqrt (x ^ 2 + y ^ 2 + z ^ 2)), y / (sqrt (x ^ 2 + y ^ 2 + z ^ 2)), z / (sqrt (x ^ 2 + y ^ 2 + z ^ 2))];
In mathematics, a unit vector in a normed vector space is a vector whose length is 1.