Ejemplo n.º 1
0
 public override void DrawGizmos(Color color)
 {
     Gizmos.color = color;
     if (m_center != null)
     {
         Gizmos.color = color;
         var     step = 64;
         var     arcLength = (2 * Mathf.PI / step) * m_radius;
         Vector3 up, right;
         up    = KaiTool_BasicGraphy.GetPerpendicularVector(m_normal);
         right = Vector3.Cross(up, m_normal).normalized;
         for (int i = 0; i < step; i++)
         {
             var startPoint = m_center + (Quaternion.AngleAxis(-360f / step * i, m_normal) * up) * m_radius;
             var dir        = Quaternion.AngleAxis(-180f / step * (2 * i + 1), m_normal) * right;
             var endPoint   = startPoint + dir * arcLength;
             Gizmos.DrawLine(startPoint, endPoint);
         }
     }
 }
Ejemplo n.º 2
0
        public override void DrawGizmos(Color color)
        {
            var direction = m_axis.Direction;
            var up        = KaiTool_BasicGraphy.GetPerpendicularVector(direction);

            if (m_axis != null)
            {
                var origin   = m_axis.m_point0;
                var terminal = m_axis.m_point1;
                var circle0  = new KaiTool_SimpleCircle(origin.position, m_axis.Direction, m_radius);
                circle0.DrawGizmos(color);
                var circle1 = new KaiTool_SimpleCircle(terminal.position, m_axis.Direction, m_radius);
                circle1.DrawGizmos(color);
                var step = 8;
                for (int i = 0; i < step; i++)
                {
                    var startPoint = origin.position + Quaternion.AngleAxis((360f / step * i), direction) * up * m_radius;
                    var endPoint   = terminal.position + Quaternion.AngleAxis((360f / step * i), direction) * up
                                     * m_radius;
                    Gizmos.color = color;
                    Gizmos.DrawLine(startPoint, endPoint);
                }
            }
        }