Handles.FreeMoveHandle 自由移动控制柄

static function FreeMoveHandle (position : Vector3, rotation : Quaternion, size : float, snap : Vector3, capFunc : DrawCapFunction) : Vector3

Parameters参数

Description描述

Make an unconstrained movement handle.

制作一个不受约束的移动控制柄。

This can move freely in all directions. Hold down CMD to snap, CMD-SHIFT to raysnap agains colliders in the scene.

这个可以在所有方向自由移动。在场景,按住CMD以捕捉,CMD-SHIFT再次跟踪捕捉碰撞器

Handles.FreeMoveHandle 自由移动控制柄

Free Move handle on the Scene View.
在场景视图中的自由移动控制柄。

// Create a simple move handle (Twice as big) on the
// target object that lets you freely move the Object
// Without having the "Move" button selected
//在target物体,创建一个简单的移动控制柄,让你自由移动物体,不必选择Move按钮

@CustomEditor (FreeMove)
class FreeMoveHandleJS extends Editor {
	function OnSceneGUI () {
		target.pos = Handles.FreeMoveHandle(target.pos,
		Quaternion.identity,
		2.0,
		Vector3.zero,
		Handles.DrawRectangle);
		if (GUI.changed)
			EditorUtility.SetDirty (target);
	}
}

And the script attached to this Handle:

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

@script ExecuteInEditMode()

var pos : Vector3 = Vector3(0,0,0);

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