float Length { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Length property of the Vector2Int struct represents the magnitude of the vector, which is the distance from the origin (0,0) to the point defined by the vector. It is calculated as the Euclidean norm of the vector, providing a single floating-point value that indicates how far the vector extends from the origin.

Usage

Use the Length property when you need to determine the magnitude of a Vector2Int instance. This can be useful in scenarios where you need to compare the size of vectors or determine the distance of a point from the origin in a 2D integer space.

Example

Vector2Int vector = new Vector2Int(3, 4);
float length = vector.Length;
// length will be 5.0, as the vector (3, 4) forms a 3-4-5 right triangle.