Description
The Length
property of the Vector3
struct represents the magnitude or length of the vector. It is calculated as the distance from the origin (0,0,0) to the point defined by the vector in 3D space. This property is useful for determining how far a point is from the origin or for normalizing vectors.
Usage
To access the length of a Vector3
instance, simply use the Length
property. This will return a float
representing the vector's magnitude.
Example
Vector3 vector = new Vector3(3, 4, 0);
float length = vector.Length;
// length will be 5, as the vector (3, 4, 0) forms a right triangle with the origin.