Handles.DrawLine 绘制线

static function DrawLine (p1 : Vector3, p2 : Vector3) : void

Description描述

Draw a line from p1 to p2.

从p1 到 p2绘制线。

Handles.DrawLine 绘制线

Draw Line 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 object to 0,0,0.
//绘制线用来连接带有脚本的物体
//如果目标物体没有任何物体被附加,然它绘制一条线从物体到0,0,0
@CustomEditor (ConnectedObjects)
class ConnectLineHandle extends Editor {

	function OnSceneGUI () {
		for(var i = 0; i < target.objs.Length; i++)
			if(target.objs[i])
				Handles.DrawLine(target.transform.position,
				target.objs[i].transform.position);
			else
				Handles.DrawLine(target.transform.position, Vector3.zero);
	}
}

And the script attached to this Handle:

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

//ConnectedObjects.js

var objs : GameObject[] = null;
Page last updated: 2011-7-8