Version: 2019.2
public static Quaternion FreeRotateHandle (int id, Quaternion rotation, Vector3 position, float size);
public static Quaternion FreeRotateHandle (Quaternion rotation, Vector3 position, float size);

パラメーター

idControl id of the handle.
rotationハンドルの向き
position3D 空間でのハンドルの中心
sizeハンドルのサイズ

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

戻り値

Quaternion ユーザーのハンドル操作によって更新された回転値。ユーザーがハンドルを操作しない場合は、関数に渡した値と同じ値が返されます。

説明

制約のない回転ハンドルを作成します。

The handle can rotate freely on all axes. The rotation gizmo has no visible axes and is simply a circle in the Scene view. Users can click and drag from within the circle to provide input rotation to your editor script.


FreeRotate handle seen in the Scene View.

// Name this script "FreeRotateEditor"
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(FreeRotate))] [CanEditMultipleObjects] public class FreeRotateEditor : Editor { public void OnSceneGUI() { FreeRotate t = (target as FreeRotate);

EditorGUI.BeginChangeCheck(); Quaternion rot = Handles.FreeRotateHandle(t.rot, Vector3.zero, 2); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Free Rotate"); t.rot = rot; t.Update(); } } }

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

// Name this script "FreeRotate"
using UnityEngine;

[ExecuteInEditMode] public class FreeRotate : MonoBehaviour { public Quaternion rot = Quaternion.identity; public void Update() { transform.rotation = rot; } }