Recommended Posts

50 minutes ago, draoth said:

If so how?

You mean some kind of center position of multiple positions?

Just handle positions as vectors, add all of them together then divide by the amount of vectors:

```_array = [position1,position2,position3];//your array holding positions
_getcenterposition = [0,0,0];

{

} foreach _array;

_vectorcount = count _array;
_getcenterposition params ["_centerX","_centerY","_centerZ"];
_center = [(_centerX / _vectorcount),(_centerY / _vectorcount),(_centerZ / _vectorcount)];```

Cheers

• 5

Share on other sites
15 hours ago, Grumpy Old Man said:

You mean some kind of center position of multiple positions?

Just handle positions as vectors, add all of them together then divide by the amount of vectors:

```
_array = [position1,position2,position3];//your array holding positions
_getcenterposition = [0,0,0];

{

} foreach _array;

_vectorcount = count _array;
_getcenterposition params ["_centerX","_centerY","_centerZ"];
_center = [(_centerX / _vectorcount),(_centerY / _vectorcount),(_centerZ / _vectorcount)];```

Cheers

Heres a universal method in arma to calculate centroid

example use:

```_positions = [
[0,0,0],
[1000,0,0],
[1000,1000,0],
[0,1000,0]
];
_centroid = _positions call QS_fnc_geomPolygonCentroid;``` • 3
• 1