Arma 3 Scripting

Function in Vectors

BIS_fnc_vectorFromXToY

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

Description

Returns a unit vector that 'points' from vector1 to vector2. This is a very useful function as it can be used with the velocity command to move an object from one position to another (i.e vector1 to vector2).

Note

Ensure both positions are found using getPosASL.

Note

Arma 3: Since Arma 3 v1.26 For better performance, use the vectorFromTo command instead.

Syntax

[vector1, vector2] call BIS_fnc_vectorFromXToY

Parameters:

Returns: Array

Examples

Example 1

private _resultVector = [getPosASL vehicle player, getPosASL airTarget] call BIS_fnc_vectorFromXToY;

See also

velocity · setVelocity · vectorAdd