Version: 5.5
public static void ConeHandleCap (int controlID, Vector3 position, Quaternion rotation, float size, EventType eventType);

パラメーター

controlID ハンドルのコントロール ID
position ハンドルを開始するワールドスペースの位置
rotation ハンドルの回転
size ワールドスペースユニットでのハンドルのサイズ
eventType ハンドルを動かすためのイベントタイプ。EventType.LayoutEventType.Repaint イベントを処理します。

説明

コーン(円錐) ハンドルを描き、これをハンドル関数に渡します。

EventType.Layout イベントでは、マウスへのハンドルの距離を計算し、それに基づいて HandleUtility.AddControl を呼び出します。

EventType.Repaint イベントでは、ハンドルの形を描画します。

注意: 画面サイズに対して固定サイズのハンドルを持ちたい場合、 HandleUtility.GetHandleSize を使用します。

// Draw shape on each axis of any GameObject
// that has the "DummyScript.cs" script attached.

// DummyScriptEditor.cs (place in Editor folder) [CustomEditor(typeof(DummyScript))] public class DummyScriptEditor : Editor { float size = 1;

void OnSceneGUI() { if (Event.current.type == EventType.Repaint) { Transform transform = (target as DummyScript).transform; Handles.color = Color.red; Handles.ConeHandleCap(0, transform.position + new Vector3(5, 0, 0), transform.rotation * Quaternion.LookRotation(new Vector3(1, 0, 0)), size, EventType.Repaint); Handles.color = Color.green; Handles.ConeHandleCap(0, transform.position + new Vector3(0, 5, 0), transform.rotation * Quaternion.LookRotation(new Vector3(0, 1, 0)), size, EventType.Repaint); Handles.color = Color.blue; Handles.ConeHandleCap(0, transform.position + new Vector3(0, 0, 5), transform.rotation * Quaternion.LookRotation(new Vector3(0, 0, 1)), size, EventType.Repaint); } } }

// DummyScript.cs public class DummyScript : MonoBehaviour {}