float Length { get; set; }

robot_2Generated
code_blocksInput

Description

The Length property of the Vector2 struct returns the magnitude of the vector. The magnitude, or length, of a vector is a measure of its size, calculated as the square root of the sum of the squares of its components. This property is useful for determining the distance of the vector from the origin in a 2D space.

Usage

To access the Length property, simply call it on an instance of Vector2. This property is read-only and provides a float value representing the vector's magnitude.

Example

Vector2 vector = new Vector2(3, 4);
float magnitude = vector.Length;
// magnitude will be 5, as the vector (3, 4) has a length of 5.