static function Slider (position : Vector3, direction : Vector3) : Vector3
static function Slider (position : Vector3, direction : Vector3, size : float, drawFunc : DrawCapFunction, snap : float) : Vector3
Description描述
Make a 3D slider
制作一个3D滑动柄。
This will draw a 3D-draggable handle on the screen. The handle is constrained to sliding along a direction vector in 3D space.
这将会在屏幕上绘制一个可拖动3D滑动柄。该控制柄被约束滑动沿着3D空间的向量方向。
Slider handle in the Scene View.
场景视图中的滑动控制柄
// Simple script that creates a Magenta Slide Handle that
// points to (0,0,0) nomatter where the target GameObject is located.
//创建一个洋红滑动控制柄指向(0,0,0),target物体的位置。
@CustomEditor (Slide)
class SliderHandleJS extends Editor {
function OnSceneGUI () {
Handles.color = Color.magenta;
target.vectorPoint = Handles.Slider (target.vectorPoint,
Vector3.zero - target.transform.position);
if (GUI.changed)
EditorUtility.SetDirty (target);
}
}
And the script attached to this Handle:
该脚本附加到这个控制柄物体:
// Usage: Place this script on the Game Object you want to use the
// editor-created slide handle.
//放置这个脚本到游戏物体
@script ExecuteInEditMode()
var vectorPoint : Vector3 = Vector3(0,0,0);
function Update() {
Debug.Log("Looking at: " + vectorPoint);
}