Version: 5.4
public static void DrawSolidArc (Vector3 center, Vector3 normal, Vector3 from, float angle, float radius);

パラメーター

center 円の中心
normal 円の法線
from 中心を基準とした扇形を開始する円周上の方向です。
angle 扇形の角度
radius 円の半径

説明

3D 空間に扇形を描画します。


Solid Arc in the Scene View.

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

この例を使用するには、以下のスクリプトを Assets/Editor フォルダーに保存します。

using UnityEngine;
using UnityEditor;

[CustomEditor( typeof( DrawSolidArc ) )] public class DrawSolidArcEditor : Editor { public float arrowSize = 1;

void OnSceneGUI( ) { DrawSolidArc t = target as DrawSolidArc;

Handles.color = Color.blue; Handles.Label( t.transform.position + Vector3.up * 2, t.transform.position.ToString( ) + "\nShieldArea: " + t.shieldArea.ToString( ) );

Handles.BeginGUI( ); GUILayout.BeginArea( new Rect( Screen.width - 100, Screen.height - 80, 90, 50 ) );

if( GUILayout.Button( "Reset Area" ) ) t.shieldArea = 5;

GUILayout.EndArea( ); Handles.EndGUI( );

Handles.color = new Color( 1, 1, 1, 0.2f ); Handles.DrawSolidArc( t.transform.position, t.transform.up, -t.transform.right, 180, t.shieldArea );

Handles.color = Color.white; t.shieldArea = Handles.ScaleValueHandle( t.shieldArea, t.transform.position + t.transform.forward * t.shieldArea, t.transform.rotation, 1, Handles.ConeCap, 1 ); } }

このスクリプトを弧を表示したいオブジェクトに置きます。

using UnityEngine;

[ExecuteInEditMode] public class DrawSolidArc : MonoBehaviour { public float shieldArea = 5; }