The Length
property of the Vector3
struct represents the magnitude of the vector, which is the distance from the origin (0,0,0) to the point defined by the vector. It is a read-only property that returns a float
value.
The Length
property of the Vector3
struct represents the magnitude of the vector, which is the distance from the origin (0,0,0) to the point defined by the vector. It is a read-only property that returns a float
value.
Use the Length
property when you need to determine the magnitude of a vector. This can be useful in various calculations, such as normalizing a vector or comparing distances between points in 3D space.
// Example of using the Length property Vector3 vector = new Vector3(3.0f, 4.0f, 0.0f); float length = vector.Length; // length will be 5.0f, as the vector (3, 4, 0) forms a 3-4-5 right triangle.