drawBezierPath() public static method

public static drawBezierPath ( Vector3 a, Vector3 b, Vector3 c, Vector3 d, float arrowSize = 0.0f, Transform arrowTransform = null ) : void
a Vector3
b Vector3
c Vector3
d Vector3
arrowSize float
arrowTransform Transform
return void
Example #1
0
    public void OnDrawGizmos()
    {
        init();

        if (pathType == LeanTweenPathType.bezier)
        {
            for (int i = 0; i < pts.Length - 3; i += 4)
            {
                if (pts[i + 1] && pts[i + 2] && pts[i + 3])
                {
                    Vector3 first = Vector3.zero;

                    if (i > 3 && pts[i - 1])
                    {
                        first = pts[i - 1].position;
                    }
                    else if (pts[i])
                    {
                        first = pts[i].position;
                    }

                    Gizmos.color = Color.magenta;
                    LeanTween.drawBezierPath(first, pts[i + 2].position, pts[i + 1].position, pts[i + 3].position, showArrows ? controlSize * 0.25f : 0.0f, transform);

                    Gizmos.color = Color.white;
                    Gizmos.DrawLine(first, pts[i + 2].position);
                    Gizmos.DrawLine(pts[i + 1].position, pts[i + 3].position);
                }
            }
            for (int i = 0; i < pts.Length; i++)
            {
                int  iMod    = i % 4;
                bool isPoint = iMod == 0 || iMod == 3;
                if (pts[i])
                {
                    pts[i].localScale = isPoint ? Vector3.one * controlSize * 0.5f : new Vector3(1f, 1f, 0.5f) * controlSize * 0.5f;
                }
            }
        }
        else
        {
            for (i = 0; i < pts.Length; i++)
            {
                if (pts[i])
                {
                    pts[i].localScale = Vector3.one * controlSize * 0.25f;
                }
            }
            LTSpline s = new LTSpline(splineVector());
            Gizmos.color = Color.magenta;
            s.gizmoDraw();
        }
    }
Example #2
0
 public static void LTDrawBezierPath(this Transform self, Vector3 a, Vector3 b, Vector3 c, Vector3 d, float arrowSize, Transform arrowTransform)
 {
     LeanTween.drawBezierPath(a, b, c, d, arrowSize, arrowTransform);
 }