format
typescript
Vector2.Distance(lhs, rhs)class: Vector2
description
Calculates the straight-line distance between two vectors.
parameter
| param_name | type | description |
|---|---|---|
| lhs | Vector2 | The lhs vector. |
| rhs | Vector2 | The rhs vector. |
return
| type | description |
|---|---|
number | The 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