Skip to content

Instantly share code, notes, and snippets.

@JonRurka
Created October 21, 2014 23:36
Show Gist options
  • Save JonRurka/87af06e9e441068d00a4 to your computer and use it in GitHub Desktop.
Save JonRurka/87af06e9e441068d00a4 to your computer and use it in GitHub Desktop.
public Vector3 CenterOfVectors( Vector3[] vectors )
{
Vector3 sum = Vector3.zero;
if( vectors == null || vectors.Length == 0 )
{
return sum;
}
foreach( Vector3 vec in vectors )
{
sum += vec;
}
return sum/vectors.Length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment