Handles.ScaleSlider 缩放滑动柄

static function ScaleSlider (scale : float, position : Vector3, direction : Vector3, rotation : Quaternion, size : float, snap : float) : float

Parameters参数

Description描述

Make a directional scale slider

制作一个方向性缩放滑动柄。

Handles.ScaleSlider 缩放滑动柄

Scale slider handle in the Scene View.
在场景视图中的缩放滑动控制柄

// Increase/decrease a value just by moving the Scale slider Handle
//增加/减少一个值,仅通过移动缩放滑动手柄
		
@CustomEditor (FreeScale)
class FreeScaleHandleJS extends Editor {
	function OnSceneGUI () {
		target.val = Handles.ScaleSlider(target.val,
		target.transform.position,
		Vector3.up,
		Quaternion.identity,
		5,
		HandleUtility.GetHandleSize(target.transform.position));
		if (GUI.changed)
			EditorUtility.SetDirty (target);
	}
}

And the script attached to this Handle:

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

// FreeScale.js
@script ExecuteInEditMode()

var val : float = 1;

function Update () {
	Debug.Log("Value tied to the slider: " + val);
}
Page last updated: 2011-7-8