static void DrawGizmo(SplineComponent spline, int stepCount)
        {
            if (spline.points.Count > 0)
            {
                var P     = 0f;
                var start = spline.GetNonUniformPoint(0);
                var step  = 1f / stepCount;
                do
                {
                    P += step;
                    var here = spline.GetNonUniformPoint(P);
                    Gizmos.DrawLine(start, here);
                    start = here;
                } while (P + step <= 1);

                Handles.color = Color.green;
                foreach (var i in spline.points)
                {
                    if (i.y != 0 || Tools.pivotRotation == PivotRotation.Global)
                    {
                        var cp  = spline.transform.TransformPoint(i);
                        var end = cp;
                        var up  = spline.transform.up;
                        if (Tools.pivotRotation == PivotRotation.Local)
                        {
                            end   = i;
                            end.y = 0;
                            end   = spline.transform.TransformPoint(end);
                        }
                        else
                        {
                            end.y = 0;
                            up    = Vector3.up;
                        }
                        if ((cp - end).sqrMagnitude > 0)
                        {
                            Handles.DrawDottedLine(cp, end, 4);
                            var discSize = HandleUtility.GetHandleSize(end) * 0.25f;
                            Handles.DrawWireDisc(end, up, discSize);
                        }
                    }
                }
                Handles.color = Color.white;
            }
        }
 void Reset()
 {
     spline = GetComponent <SplineComponent>();
 }
 static void DrawGizmosHiRes(SplineComponent spline, GizmoType gizmoType)
 {
     Gizmos.color = Color.white;
     DrawGizmo(spline, 1024);
 }
示例#4
0
 public SplineIndex(SplineComponent spline)
 {
     this.spline = spline;
     ReIndex();
 }