UnityEditor.Handles.ConeHandleCap C# (CSharp) Method

ConeHandleCap() public static method

Draw a cone handle. Pass this into handle functions.

public static ConeHandleCap ( int controlID, Vector3 position, Quaternion rotation, float size, EventType eventType ) : void
controlID int The control ID for the handle.
position Vector3 The world-space position of the handle's start point.
rotation UnityEngine.Quaternion The rotation of the handle.
size float The size of the handle in world-space units.
eventType EventType Event type for the handle to act upon. By design it handles EventType.Layout and EventType.Repaint events.
return void
        public static void ConeHandleCap(int controlID, Vector3 position, Quaternion rotation, float size, EventType eventType)
        {
            if (eventType != EventType.Layout)
            {
                if (eventType == EventType.Repaint)
                {
                    Graphics.DrawMeshNow(s_ConeMesh, StartCapDraw(position, rotation, size));
                }
            }
            else
            {
                HandleUtility.AddControl(controlID, HandleUtility.DistanceToCircle(position, size));
            }
        }

Usage Example

Beispiel #1
0
            public override void Draw()
            {
                InitDraw();

                if (m_PrimaryShape != null)
                {
                    m_PrimaryShape.Draw();
                }

                for (int i = 0; i < m_Points.Length; i++)
                {
                    Handles.DrawLine(m_Points[i], m_SecondaryPoints[i], c_LineThickness);
                    // Makes the arrow heads a lot nicer for close casts
                    var cone = Mathf.Lerp(0f, c_ConeSize, m_Distance / 20f);
                    cone = Mathf.Clamp(cone, 0.1f, c_ConeSize);
                    Handles.ConeHandleCap(0, m_ConePoints[i], m_LookRotation, cone, EventType.Repaint);
                }

                if (m_IsFiniteDistance && m_SecondaryShape != null)
                {
                    m_SecondaryShape.Draw();
                }
            }