Handles.ScaleHandle 缩放控制柄

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

Parameters参数

Returns

Vector3 - the new scale vector. Note: Use HandleUtility.GetHandleSize where you might want to have constant screen-sized handles.

返回三维向量,新的缩放向量。注意:使用Use HandleUtility.GetHandleSize你可能希望有恒定屏幕大小的控制柄。

Description描述

Make a Scene view scale handle

创建一个场景视图缩放控制柄。

This will behave like the built-in scale tool

这行为就像内置的缩放工具。

Handles.ScaleHandle 缩放控制柄

Scale handle that will appear whenever you select the GameObject.
缩放控制柄显示在旋转的游戏物体。

// Creates a "Big" (5 times size) Scale handle that will be present whenever
// you select the target Game Object
//在当前选择的target游戏物体,创建一个大的缩放控制柄(5倍大小)
@CustomEditor (ScaleAtPoint)
class ScaleHandleJS extends Editor {
	function OnSceneGUI () {
		target.sc = Handles.ScaleHandle (target.sc,
		target.transform.position,
		target.transform.rotation,
		5.0);
		Debug.Log(target.sc);
		if (GUI.changed)
			EditorUtility.SetDirty (target);
	}
}

And the Script attached to this handle:

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

// ScaleAtPoint.js
// Usage: Place this script on the Game Object you want to use the
// editor-created scale handle.
//用法:把这个脚本放到你想使用编辑器创建的缩放控制柄的游戏物体上。

@script ExecuteInEditMode()

var sc : Vector3 = Vector3(1,1,1);

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