Gizmos.DrawRay 绘制射线

static function DrawRay (r : Ray) : void
static function DrawRay (from : Vector3) : void

Description描述

Draws a ray starting at from to from + direction.

绘制一条射线从from起点到direction方向和位置。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void OnDrawGizmosSelected() {

		Gizmos.color = Color.red;

		Vector3.forward) * 5;

		Gizmos.DrawRay(transform.position, direction);

	}

}
function OnDrawGizmosSelected () {

	// Draws a 5 meter long red line in front of the object

	//在物体的前面绘制一个5米长红色的线

	Gizmos.color = Color.red;

	var direction : Vector3.forward) * 5;

	Gizmos.DrawRay (transform.position, direction);

}
Page last updated: 2010-12-25