# ArcHandle

> A class for a compound handle to edit an angle and a radius in the Scene view.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor.IMGUI.Controls](/engine/6000.7/script-reference/unityeditor/imgui/controls.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public class ArcHandle
```

## Remarks

![ArcHandle (ArcHandle)](/api/media?file=/engine/6000.7/media/images/ArcHandle.png)

*ArcHandle in the Scene View.*

This class allows you to display control handles for editing the angle and radius of an arc. The arc originates at [Vector3.forward](/engine/6000.7/script-reference/unityengine/vector3/forward.md) multiplied by the [ArcHandle.radius](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/radius.md) and rotates around [Vector3.up](/engine/6000.7/script-reference/unityengine/vector3/up.md). The handle rendered by this class's [ArcHandle.DrawHandle](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/drawhandle.md) method is affected by global state in the [Handles](/engine/6000.7/script-reference/unityeditor/handles.md) class, such as [Handles.matrix](/engine/6000.7/script-reference/unityeditor/handles/matrix.md) and [Handles.color](/engine/6000.7/script-reference/unityeditor/handles/color.md).

The following component defines an object with an angle and force property.

```csharp
using UnityEngine;

public class ProjectileExample : MonoBehaviour
{
    public float elevationAngle { get { return m_ElevationAngle; } set { m_ElevationAngle = value; } }
    [SerializeField]
    float m_ElevationAngle = 45f;

    public float impulse { get { return m_Impulse; } set { m_Impulse = value; } }
    [SerializeField]
    float m_Impulse = 20f;

    public Vector3 facingDirection
    {
        get
        {
            Vector3 result = transform.forward;
            result.y = 0f;
            return result.sqrMagnitude == 0f ? Vector3.forward : result.normalized;
        }
    }

    protected virtual void Start()
    {
        GameObject ball = GameObject.CreatePrimitive(PrimitiveType.Sphere);

        Vector3 direction = facingDirection;
        direction = Quaternion.AngleAxis(elevationAngle, Vector3.Cross(direction, Vector3.up)) * direction;
        ball.AddComponent<Rigidbody>().AddForce(direction  * impulse, ForceMode.Impulse);
    }
}
```

The following Custom Editor example allows you to edit the elevation angle and force properties for this component in the Scene view, where the force is represented by the radius of the handle.

```csharp
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEngine;

[CustomEditor(typeof(ProjectileExample))]
public class ProjectileExampleEditor : Editor
{
    ArcHandle m_ArcHandle = new ArcHandle();

    protected virtual void OnEnable()
    {
        // arc handle has no radius handle by default
        m_ArcHandle.SetColorWithRadiusHandle(Color.white, 0.1f);
    }

    // the OnSceneGUI callback uses the Scene view camera for drawing handles by default
    protected virtual void OnSceneGUI()
    {
        ProjectileExample projectileExample = (ProjectileExample)target;

        // copy the target object's data to the handle
        m_ArcHandle.angle = projectileExample.elevationAngle;
        m_ArcHandle.radius = projectileExample.impulse;

        // set the handle matrix so that angle extends upward from target's facing direction along ground
        Vector3 handleDirection = projectileExample.facingDirection;
        Vector3 handleNormal = Vector3.Cross(handleDirection, Vector3.up);
        Matrix4x4 handleMatrix = Matrix4x4.TRS(
            projectileExample.transform.position,
            Quaternion.LookRotation(handleDirection, handleNormal),
            Vector3.one
        );

        using (new Handles.DrawingScope(handleMatrix))
        {
            // draw the handle
            EditorGUI.BeginChangeCheck();
            m_ArcHandle.DrawHandle();
            if (EditorGUI.EndChangeCheck())
            {
                // record the target object before setting new values so changes can be undone/redone
                Undo.RecordObject(projectileExample, "Change Projectile Properties");

                // copy the handle's updated data back to the target object
                projectileExample.elevationAngle = m_ArcHandle.angle;
                projectileExample.impulse = m_ArcHandle.radius;
            }
        }
    }
}
```

Additional Resources: [Editor.OnSceneGUI()](/engine/6000.7/script-reference/unityeditor/editor/onscenegui.md), [Handles.SetCamera](/engine/6000.7/script-reference/unityeditor/handles/setcamera.md).

## Constructors

| Constructor                                                                                 | Description                                                                                                               |
| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| [ArcHandle()](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/ctor.md) | Creates a new instance of the [ArcHandle](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle.md) class. |

## Properties

| Property                                                                                                                     | Description                                                                                                                                              |
| ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [angle](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/angle.md)                                       | Returns or specifies the angle of the arc for the handle.                                                                                                |
| [angleHandleColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/anglehandlecolor.md)                 | Returns or specifies the color of the angle control handle.                                                                                              |
| [angleHandleDrawFunction](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/anglehandledrawfunction.md)   | The [Handles.CapFunction](/engine/6000.7/script-reference/unityeditor/handles/capfunction.md) to use when displaying the angle control handle.           |
| [angleHandleSizeFunction](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/anglehandlesizefunction.md)   | The [Handles.SizeFunction](/engine/6000.7/script-reference/unityeditor/handles/sizefunction.md) to specify how large the angle control handle should be. |
| [fillColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/fillcolor.md)                               | Returns or specifies the color of the arc shape.                                                                                                         |
| [radius](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/radius.md)                                     | Returns or specifies the radius of the arc for the handle.                                                                                               |
| [radiusHandleColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/radiushandlecolor.md)               | Returns or specifies the color of the radius control handle.                                                                                             |
| [radiusHandleDrawFunction](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/radiushandledrawfunction.md) | The [Handles.CapFunction](/engine/6000.7/script-reference/unityeditor/handles/capfunction.md) to use when displaying the radius control handle.          |
| [radiusHandleSizeFunction](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/radiushandlesizefunction.md) | The [Handles.SizeFunction](/engine/6000.7/script-reference/unityeditor/handles/sizefunction.md) to specify how large the angle control handle should be. |
| [wireframeColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/wireframecolor.md)                     | Returns or specifies the color of the curved line along the outside of the arc.                                                                          |

## Methods

| Method                                                                                                                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [DrawHandle](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/drawhandle.md)                                   | A function to display this instance in the current handle camera using its current configuration.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [SetColorWithoutRadiusHandle](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/setcolorwithoutradiushandle.md) | Sets [ArcHandle.angleHandleColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/anglehandlecolor.md), [ArcHandle.wireframeColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/wireframecolor.md), and [ArcHandle.fillColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/fillcolor.md) to the same value, where [ArcHandle.fillColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/fillcolor.md) will have the specified alpha value. [ArcHandle.radiusHandleColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/radiushandlecolor.md) will be set to [Color.clear](/engine/6000.7/script-reference/unityengine/color/clear.md) and the radius handle will be disabled. |
| [SetColorWithRadiusHandle](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/setcolorwithradiushandle.md)       | Sets [ArcHandle.angleHandleColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/anglehandlecolor.md), [ArcHandle.radiusHandleColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/radiushandlecolor.md), [ArcHandle.wireframeColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/wireframecolor.md), and [ArcHandle.fillColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/fillcolor.md) to the same value, where [ArcHandle.fillColor](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/fillcolor.md) will have the specified alpha value.                                                                                                                                 |

## Static Methods

| Method                                                                                                                                     | Description                                                                                                                                                                                                                          |
| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [DefaultAngleHandleDrawFunction](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/defaultanglehandledrawfunction.md)   | A [Handles.CapFunction](/engine/6000.7/script-reference/unityeditor/handles/capfunction.md) that draws a line terminated with [Handles.CylinderHandleCap](/engine/6000.7/script-reference/unityeditor/handles/cylinderhandlecap.md). |
| [DefaultAngleHandleSizeFunction](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/defaultanglehandlesizefunction.md)   | A [Handles.SizeFunction](/engine/6000.7/script-reference/unityeditor/handles/sizefunction.md) that returns a fixed screen-space size.                                                                                                |
| [DefaultRadiusHandleSizeFunction](/engine/6000.7/script-reference/unityeditor/imgui/controls/archandle/defaultradiushandlesizefunction.md) | A [Handles.SizeFunction](/engine/6000.7/script-reference/unityeditor/handles/sizefunction.md) that returns a fixed screen-space size.                                                                                                |
