Ejemplo n.º 1
0
    void OnDrawGizmos()
    {
        Transform[] trans = GetTransforms();
        if (trans.Length < 2)
        {
            return;
        }

        SplineInterpolator interp = GetComponent(typeof(SplineInterpolator)) as SplineInterpolator;

        SetupSplineInterpolator(interp, trans);
        interp.StartInterpolation(null, false, WrapMode);


        Vector3 prevPos = trans[0].position;

        for (int c = 1; c <= 100; c++)
        {
            float   currLen = c * Len / 100;
            Vector3 currPos = interp.GetHermiteAtLen(currLen);
            float   mag     = (currPos - prevPos).magnitude * 2;
            Gizmos.color = new Color(mag, 0, 0, 1);
            Gizmos.DrawLine(prevPos, currPos);
            prevPos = currPos;
        }
    }