public static float PathLength(Transform[] path)
{
Vector3[] suppliedPath = new Vector3[path.Length];
float pathLength = 0;
//create and store path points:
for (int i = 0; i < path.Length; i++) {
suppliedPath[i]=path[i].position;
}
Vector3[] vector3s = PathControlPointGenerator(suppliedPath);
//Line Draw:
Vector3 prevPt = Interp(vector3s,0);
int SmoothAmount = path.Length*20;
for (int i = 1; i <= SmoothAmount; i++) {
float pm = (float) i / SmoothAmount;
Vector3 currPt = Interp(vector3s,pm);
pathLength += Vector3.Distance(prevPt,currPt);
prevPt = currPt;
}
return pathLength;
}