Handles
- ArrowCap
- BeginGUI
- Button
- CircleCap
- ClearCamera
- color
- ConeCap
- CubeCap
- currentCamera
- CylinderCap
- Disc
- DotCap
- DrawAAPolyLine
- DrawBezier
- DrawCamera
- DrawCapFunction
- DrawLine
- DrawPolyLine
- DrawSolidArc
- DrawSolidDisc
- DrawSolidRectangleWithOutline
- DrawWireArc
- DrawWireDisc
- EndGUI
- FreeMoveHandle
- FreeRotateHandle
- Label
- lighting
- matrix
- PositionHandle
- RadiusHandle
- RectangleCap
- RotationHandle
- ScaleHandle
- ScaleSlider
- ScaleValueHandle
- SetCamera
- Slider2D
- Slider
- SnapValue
- SphereCap
Handles.Slider 滑动柄
static function Slider (position : Vector3, direction : Vector3) : Vector3
static function Slider (position : Vector3, direction : Vector3, size : float, drawFunc : DrawCapFunction, snap : float) : Vector3
Parameters参数
-
positionthe position of the current point. // 当前的位置
-
directionthe direction of the sliding. // 滑向的方向。
-
float3D size the size of the handle - HandleUtility.GetHandleSize (position);
控制柄的大小 -
drawFuncthe function to call for doing the actual drawing - by default, it's Handles.ArrowCap, but any function that has the same signature can be used. Note: Use HandleUtility.GetHandleSize where you might want to have constant screen-sized handles.
调用函数来用于实际的绘制,默认是Handles.ArrowCap,但任意函数具有相同的签名可以被使用。注意:使用HandleUtility.GetHandleSize,你可能希望有恒定屏幕大小的控制柄。
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);
}
最后修改:2011年7月7日 Thursday 17:28