public static void DrawAngle(UnityEngine.Vector3 center, UnityEngine.Vector3 direction, UnityEngine.Vector3 axis, float angle) { var rotation = UnityEngine.Quaternion.AngleAxis(angle, axis); var centerSize = UnityEditor.HandleUtility.GetHandleSize(center); var maxSize = direction.magnitude; var xdir = direction / maxSize; //var ydir = UnityEngine.Vector3.Cross(xdir, axis); var handleSize = Mathf.Min(centerSize, maxSize); var drawAngle = UnityEngine.Mathf.Clamp(angle, -360, 360); var realLength = Mathf.Max(1, Mathf.CeilToInt((anglePoints.Length / 360.0f) * Mathf.Abs(drawAngle))); var pointSize = centerSize * 0.04f; SceneHandles.color = SceneHandles.StateColor(SceneHandles.measureColor); SceneHandles.DrawAAPolyLine(center + (xdir * pointSize), center + direction); SceneHandles.DrawAAPolyLine(center + (rotation * (xdir * pointSize)), center + (rotation * direction)); SceneHandles.DrawWireDisc(center, Vector3.forward, pointSize); direction = xdir * handleSize; if (UnityEngine.Mathf.Abs(angle) > 0.0f) { var angleStep = drawAngle / realLength; var curAngle = 0.0f; for (int i = 0; i < realLength; i++) { anglePoints[i] = center + (UnityEngine.Quaternion.AngleAxis(curAngle, axis) * direction); curAngle += angleStep; } SceneHandles.DrawDottedLines(anglePoints.Take(realLength).ToArray(), 4.0f); rotation = UnityEngine.Quaternion.AngleAxis(angle, axis); var right = rotation * Vector3.right; var endPoint = center + (rotation * direction); var arrowSize = handleSize * 0.2f; // UnityEditor.HandleUtility.GetHandleSize(endPoint) * 0.2f; if (angle < 0.0f) { DrawFlatArrow(endPoint, -right, arrowSize); } else { DrawFlatArrow(endPoint, right, arrowSize); } } Vector3 facing; Vector3 position; if (handleSize == maxSize) { facing = rotation * xdir; position = center + (facing * handleSize); } else { var halfRotation = UnityEngine.Quaternion.AngleAxis(drawAngle / 2.0f, axis); facing = halfRotation * xdir; position = center; } DrawLabel(position, facing, 5, angle + "°"); }