format
typescript
Vector2.magnitudeclass: Vector2
description
(Read Only) Returns the length of this vector. This method is an accurate way to calculate the length of a vector, it returns the actual length of the vector. It is achieved by calculating the square sum of the vector (xx+yy), and then taking the square root.
parameter
| param_name | type | description |
|---|
reture
| type | description |
|---|---|
number | The length of the vector. |
code example
typescript
let rhs = new Vector2(3, 4);
Debug.Log(rhs.magnitude); // 5