Handles.DrawAAPolyLine 绘制AA多段线

static function DrawAAPolyLine (params points : Vector3[]) : void
static function DrawAAPolyLine (width : float, params points : Vector3[]) : void
static function DrawAAPolyLine (lineTex : Texture2D, params points : Vector3[]) : void
static function DrawAAPolyLine (lineTex : Texture2D, width : float, params points : Vector3[]) : void

Parameters参数

Description描述

Draw anti-aliased line specified with point array and width.

绘制指定的抗锯齿线带有点的数组和宽度。

Note: Use HandleUtility.GetHandleSize where you might want to have constant screen-sized handles.

注意:使用HandleUtility.GetHandleSize你可能希望有恒定屏幕大小的控制柄。

Handles.DrawPolyLine 绘制多段线

PolyLine that connects all the objects in the Scene View.
在场景视图多段线连接所有物体。

// Draw lines to the connected game objects that a script has.
// if the target object doesnt have any game objects attached
// then it draws a line from the Last checked object to 0,0,0
//绘制线用来连接带有脚本的物体
//如果目标物体没有任何物体被附加,然它绘制一条线从物体到0,0,0
@CustomEditor (ConnectedPolyLine)
class ConnectedPolyLineHandle extends Editor {

	var positions : Vector3[];

	function OnSceneGUI () {
		if(target.polyLineObjs.Length > 0)
		positions = new Vector3[target.polyLinesObjs.Length];
		for(var i = 0; i < target.polyLineObjs.Length; i++)
			if(target.polyLineObjs[i])
				positions[i] = target.polyLineObjs[i].transform.position;
			else
				positions[i] = Vector3.zero;
			Handles.DrawPolyLine(positions);
	}
}

And the script attached to this Handle:

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

//ConnectedPolyLine.js

var polyLineObjs : GameObject[];
最后修改:2011年7月8日 Friday 20:08

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。