文档

Unity Engine

Unity Engine

Distance

Calculates the distance between two given vectors.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

Distance(Vector3Int, Vector3Int)

Calculates the distance between two given vectors.
public static float Distance(Vector3Int a, Vector3Int b)

Parameters

The first vector to check.

The second vector to check.

Returns

Type

Description

floatThe distance between
a
and
b
.

Remarks

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

Distance(Vector3Int, Vector3Int)

Calculates the distance between two given vectors.
public static float Distance(in Vector3Int a, in Vector3Int b)

Parameters

The first vector to check.

The second vector to check.

Returns

Type

Description

floatThe distance between
a
and
b
.

Remarks

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