From 8de35419c120237f92c246eb49b98ecafd8895f8 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Tue, 14 Jun 2016 13:02:18 +0100 Subject: [PATCH] Ryans Support Quite likely there is a native function for this. Input total of multiple vectors and divide to find average. --- .../functions/EPOCH_fnc_vectorDivide.sqf | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Sources/epoch_code/compile/functions/EPOCH_fnc_vectorDivide.sqf diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_vectorDivide.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_vectorDivide.sqf new file mode 100644 index 00000000..36d45a9e --- /dev/null +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_vectorDivide.sqf @@ -0,0 +1,30 @@ +/* + Author: Andrew Gregory - EpochMod.com + + Contributors: + + Description: + Divide a Vector (Average Position / Vector). + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/compile/functions/EPOCH_fnc_vectorDivide.sqf + + Example: + _averageVector = [[15,15,3],3] call EPOCH_fnc_vectorDivide; + + Parameter(s): + _this select 0: ARRAY - Vector / Position + _this select 1: INT - Divide by + + Returns: + ARRAY - Averag Vector +*/ +params ["_vec","_div",["_doZ",true],["_out",[0,0,0]]]; +_out set [0,_vec select 0 / _div]; +_out set [1,_vec select 1 / _div]; +_out set [2,0]; +if(_doZ)then{_out set [2,_vec select 2 / _div];}; +_out