Description
Unit vector, equal to direction from vector1 to vector2. In other words this command produces normalised vector between given 2 points.
To get a non-normalised vector, use vectorDiff.
Syntax
vector1 vectorFromTo vector2
Parameters:
vector1: Vector3D or Vector2D - 3D or Arma 3 v2.00 2D vector (z coordinate is defaulted to 0)
vector2: Vector3D or Vector2D - 3D or Arma 3 v2.00 2D vector (z coordinate is defaulted to 0)
Returns: Vector3D
Examples
Example 1
[1,2,3] vectorFromTo [4,5,6];
vectorNormalized ([4,5,6] vectorDiff [1,2,3]);
See also
vectorDiff · vectorCrossProduct · vectorDotProduct · vectorCos · vectorMagnitude · vectorMagnitudeSqr · vectorMultiply · vectorDistance · vectorDistanceSqr · vectorDir · vectorUp · setVectorDir · setVectorUp · setVectorDirAndUp · vectorNormalized · matrixMultiply · matrixTranspose
Arma 3 v1.26 Algorithm:
_vector1 = [x1,y1,z1];
_vector2 = [x2,y2,z2];
_result = [
(x1 - x2) / (sqrt ((x1 - x2) ^ 2 + (y1 - y2) ^ 2 + (z1 - z2) ^ 2)),
(y1 - y2) / (sqrt ((x1 - x2) ^ 2 + (y1 - y2) ^ 2 + (z1 - z2) ^ 2)),
(z1 - z2) / (sqrt ((x1 - x2) ^ 2 + (y1 - y2) ^ 2 + (z1 - z2) ^ 2))
];