Vector3.Distance 距离

static function Distance (a : Vector3, b : Vector3) : float

Description描述

Returns the distance between a and b.

返回a和b之间的距离。

Vector3.Distance(a,b) is the same as (a-b).magnitude

Vector3.Distance(a,b) 等同于(a-b).magnitude 。

var other : Transform;
if (other) {
	var dist = Vector3.Distance(other.position, transform.position);
	print ("Distance to other: " + dist);
}
最后修改:2010年12月20日 Monday 22:11

本脚本参考基于Unity 3.4.1f5

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