UnityEditor.Handles.DoConeHandle C# (CSharp) Method

DoConeHandle() static private method

static private DoConeHandle ( Quaternion rotation, Vector3 position, Vector2 angleAndRange, float angleScale, float rangeScale, bool handlesOnly ) : Vector2
rotation UnityEngine.Quaternion
position Vector3
angleAndRange Vector2
angleScale float
rangeScale float
handlesOnly bool
return Vector2
        internal static Vector2 DoConeHandle(Quaternion rotation, Vector3 position, Vector2 angleAndRange, float angleScale, float rangeScale, bool handlesOnly)
        {
            float x = angleAndRange.x;
            float y = angleAndRange.y;
            float r = y * rangeScale;
            Vector3 d = (Vector3) (rotation * Vector3.forward);
            Vector3 vector2 = (Vector3) (rotation * Vector3.up);
            Vector3 vector3 = (Vector3) (rotation * Vector3.right);
            bool changed = GUI.changed;
            GUI.changed = false;
            r = SizeSlider(position, d, r);
            if (GUI.changed)
            {
                y = Mathf.Max((float) 0f, (float) (r / rangeScale));
            }
            GUI.changed |= changed;
            changed = GUI.changed;
            GUI.changed = false;
            float num4 = (r * Mathf.Tan((0.01745329f * x) / 2f)) * angleScale;
            num4 = SizeSlider(position + ((Vector3) (d * r)), vector2, num4);
            num4 = SizeSlider(position + ((Vector3) (d * r)), -vector2, num4);
            num4 = SizeSlider(position + ((Vector3) (d * r)), vector3, num4);
            num4 = SizeSlider(position + ((Vector3) (d * r)), -vector3, num4);
            if (GUI.changed)
            {
                x = Mathf.Clamp((float) ((57.29578f * Mathf.Atan(num4 / (r * angleScale))) * 2f), (float) 0f, (float) 179f);
            }
            GUI.changed |= changed;
            if (!handlesOnly)
            {
                DrawLine(position, (Vector3) ((position + (d * r)) + (vector2 * num4)));
                DrawLine(position, (Vector3) ((position + (d * r)) - (vector2 * num4)));
                DrawLine(position, (Vector3) ((position + (d * r)) + (vector3 * num4)));
                DrawLine(position, (Vector3) ((position + (d * r)) - (vector3 * num4)));
                DrawWireDisc(position + ((Vector3) (r * d)), d, num4);
            }
            return new Vector2(x, y);
        }