Handles.FreeRotateHandle 自由旋转控制柄

static function FreeRotateHandle (rotation : Quaternion, position : Vector3, size : float) : Quaternion

Parameters参数

Description描述

Make an unconstrained rotation handle.

创建不受约束的旋转控制柄。

The handle can rotate freely on all axes.

该控制柄所有轴可以自由旋转。

Handles.FreeRotateHandle 自由旋转控制柄

FreeRotate handle seen in the Scene View.
在场景视图看到的自由旋转控制柄。

// Create a simple rotate handle (half scale) on the
// target object that lets you freely rotate
// the Object Without having to select the "Rotate" button
//在target物体上,创建一个简单的旋转控制柄,让你可以自由旋转物体,不必选择Rotate按钮。

@CustomEditor (FreeRotate)
class FreeRotateHandleJS extends Editor {
	function OnSceneGUI () {
		target.rot = Handles.FreeRotateHandle(target.rot, target.transform.position, 0.5);
		if (GUI.changed)
			EditorUtility.SetDirty (target);
	}
}

And the script attached to this Handle:

该脚本附加到这个控制柄物体:

@script ExecuteInEditMode()

var rot : Quaternion = Quaternion.identity;

function Update () {
	transform.rotation = rot;
}
Page last updated: 2011-7-7