Skip to content

format

typescript
Vector3.magnitude

class: Vector3

description

(Read Only) The length of the vector.

Returns the actual length of the vector. It is calculated by computing the square root of the sum of squares of the vector's components (xx+yy+z*z). Due to the square root operation involved, it has a relatively higher computational cost compared to sqrMagnitude, but it provides an accurate length value.

parameter

param_nametypedescription

reture

typedescription
numberThe length of this vector.

code example

typescript
let lhs = new Vector3(1,-2,-3);
Debug.Log("(1,-2,-3) magnitude is",lhs.magnitude);