unity take average of all vector3
//Credit: Grofie - https://answers.unity.com/questions/164257/find-the-average-of-10-vectors.html
private Vector3 GetMeanVector(Vector3[] positions)
{
if (positions.Length == 0)
return Vector3.zero;
float x = 0f;
float y = 0f;
float z = 0f;
foreach (Vector3 pos in positions)
{
x += pos.x;
y += pos.y;
z += pos.z;
}
return new Vector3(x / positions.Length, y / positions.Length, z / positions.Length);
}