- Home /
Question by
Gekigengar · Apr 29, 2016 at 08:58 PM ·
c#gizmosgizmohandles
Gizmo equivalent of Handles.DrawSolidArc?
Is there any gizmo equivalent of Handles.DrawSolidArc?
http://docs.unity3d.com/ScriptReference/Handles.DrawSolidArc.html
using UnityEditor;
using UnityEngine;
using System.Collections;
[CustomEditor(typeof(LOSSystem))]
[CanEditMultipleObjects]
public class DrawLOS : Editor {
void OnSceneGUI() {
Handles.color = new Color(0.8f,0.8f,0.8f,0.2f);
LOSSystem myObj = (LOSSystem) target;
Handles.DrawSolidArc(
myObj.transform.position + new Vector3(0, 7, 0),
myObj.transform.up,
Quaternion.AngleAxis((myObj.sightAngle/2)-myObj.sightAngle, myObj.transform.up) * myObj.transform.forward * myObj.sightRange,
myObj.sightAngle,
myObj.sightRange);
Handles.color = new Color(0.8f,0.0f,0.0f,0.2f);
Handles.DrawSolidArc(
myObj.transform.position + new Vector3(0, 8, 0),
myObj.transform.up,
Quaternion.AngleAxis((myObj.absoluteAngle/2)-myObj.absoluteAngle, myObj.transform.up) * myObj.transform.forward * myObj.absoluteRange,
myObj.absoluteAngle,
myObj.absoluteRange);
}
}
This is what I use to draw them in my scene, which perfectly represents my sight range and angle, and I need them to visualize sight range as Gizmos.
If there is no gizmo equivalent, how do I make one? Thanks!
Comment