Example Code: Get Center
Jump to navigation
Jump to search
/*
Author: R3vo
Date: 2019-08-18
Description:
Returns the center position of given coordinates or objects.
Parameter(s):
0: ARRAY - Array of positions,objects, markers, groups or locations.
Returns:
ARRAY - Array of center in form [x,y,z]
*/
#define POSITIONS allUnits //Array of positions,objects, markers, groups or locations.
private _sumPositions = [0,0,0];
{
_sumPositions = _sumPositions vectorAdd (_x call BIS_fnc_position);
} forEach POSITIONS;
//Return center position
_sumPositions vectorMultiply 1 / count POSITIONS