iTween.PathLength C# (CSharp) Method

PathLength() public static method

Returns the length of a curved path drawn through the provided array of Transforms.
public static PathLength ( Transform path ) : float
path Transform /// A ///
return float
    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;
    }

Same methods

iTween::PathLength ( Vector3 path ) : float
iTween