示例#1
0
        protected void OnDrawGizmos()
        {
            if (Curve == null)
            {
                return;
            }

            for (int s = 0; s < Curve.SegmentCount; ++s)
            {
                var segment = Curve.GetSegment(s);
                var points  = segment.Points;

                if (ShowSegments)
                {
                    using (new GizmosColorScope(SegmentColors.LoopedAt(s, Color.cyan)))
                    {
                        for (int i = 0; i < points.Count - 1; ++i)
                        {
                            var p0 = points[i];
                            var p1 = points[i + 1];
                            GizmosEx.DrawLine(p0, p1, transform);
                        }
                    }
                }

                if (ShowPoints)
                {
                    using (new GizmosColorScope(Color.yellow))
                    {
                        foreach (var point in points)
                        {
                            GizmosEx.DrawCross(point, PointSize, transform);
                        }
                    }
                }
            }

            if (ShowKeyPoints)
            {
                using (new GizmosColorScope(Color.magenta))
                {
                    foreach (var point in Curve.KeyPoints)
                    {
                        GizmosEx.DrawCross(point, PointSize, transform);
                    }
                }
            }
        }
示例#2
0
        protected override void OnDrawGizmos()
        {
            base.OnDrawGizmos();

            if (Spline == null)
            {
                return;
            }

            if (ShowTangents)
            {
                using (new GizmosColorScope(Color.magenta))
                {
                    for (int i = 0; i < Spline.PointCount; ++i)
                    {
                        var p = Spline[i];
                        var t = Spline.Tangents[i];
                        GizmosEx.DrawLine(p, p + t, transform);
                    }
                }
            }
        }