Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Handles.CylinderCap

マニュアルに切り替える
public static void CylinderCap(int controlID, Vector3 position, Quaternion rotation, float size);

パラメーター

controlID ハンドルのコントロール ID
position ハンドルを開始するワールドスペースの位置
rotation ハンドルの回転
size ワールドスペースユニットでのハンドルのサイズ

説明

シリンダーを描き、これをハンドル関数に渡します。

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


" シーンビューの Cylinder Cap "

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

このハンドルにアタッチしているスクリプト

using UnityEngine;
using UnityEditor;

[CustomEditor( typeof( DummyCylinderCap ) )] public class CylinderCapEditor : Editor { public float cylinderSize = 1;

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

Handles.color = Color.red; Handles.CylinderCap( 0, t.transform.position + new Vector3( 5, 0, 0 ), t.transform.rotation, cylinderSize );

Handles.color = Color.green; Handles.CylinderCap( 0, t.transform.position + new Vector3( 0, 5, 0 ), t.transform.rotation, cylinderSize );

Handles.color = Color.blue; Handles.CylinderCap( 0, t.transform.position + new Vector3( 0, 0, 5 ), t.transform.rotation, cylinderSize ); } }

このスクリプトを円柱 (cylinder) のハンドルを表示したいオブジェクトにアタッチします。

using UnityEngine;

[ExecuteInEditMode] public class DummyCylinderCap : MonoBehaviour { public void Start( ) { Debug.Log( "I have CylinderCap Handles attached to this transform!" ); } }