Version: 5.4
public static void CylinderCap (int controlID, Vector3 position, Quaternion rotation, float size);

パラメーター

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

説明

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

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


Cylinder Cap in the Scene View.

この例を使用するには、以下のスクリプトを 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!" ); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961