Handles.Disc 圆形

static function Disc (rotation : Quaternion, position : Vector3, axis : Vector3, size : float, cutoffPlane : bool, snap : float) : Quaternion

Parameters参数

Description描述

Make a 3D disc that can be dragged with the mouse

制作一个3D圆形,可以被鼠标拖动。

Handles.Disc 圆形

Disc Handle on the Scene View.
场景视图中的圆形控制柄。

// Create a handle to rotate an object over 45 degrees on X and Y axis
//创建一个控制柄来旋转物体,在x和y轴超过45度

@CustomEditor (DiscValueModifier)
class DiscHandle extends Editor {
	function OnSceneGUI () {
		target.rot =
		Handles.Disc(target.rot,
			target.transform.position,
			Vector3(1,1,0),
			5,
			false,
			1);

		if (GUI.changed)
			EditorUtility.SetDirty (target);
	}
}

And the script attached to this Handle:

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

// Usage: Place this script on the Game Object you want to modify
// the handle's rot with the disc
//放置这个脚本到你想使用disc修改控制柄的rot的游戏物体
		
@script ExecuteInEditMode()

var rot : Quaternion = Quaternion.identity;

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