Skip to content

format

typescript
Vector2.Distance(lhs, rhs)

class: Vector2

description

Calculates the straight-line distance between two vectors.

parameter

param_nametypedescription
lhsVector2The lhs vector.
rhsVector2The rhs vector.

return

typedescription
numberThe distance between lhs and rhs.

code example

typescript
let lhs = new Vector2(1, 2);
let rhs = new Vector2(4, 6);
Debug.Log(Vector2.Distance(lhs, rhs)); // 5