format
typescript
Vector3.sqrMagnitudeclass: Vector3
description
(Read Only) The square magnitude of the current vector.
Returns the square magnitude of the vector. It is calculated by summing the squares of each component, without involving square root calculations. Because there is no square root operation, it is faster than magnitude. It is commonly used for comparing lengths without needing the exact length value.
parameter
| param_name | type | description |
|---|
reture
| type | description |
|---|---|
number | The square magnitude of the current vector. |
code example
typescript
let lhs = new Vector3(1,-2,-3);
Debug.Log("(1,-2,-3) sqrMagnitude is",lhs.sqrMagnitude);