Vector2 Normal { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Normal property of the Vector2Int struct returns a unit vector (a vector with a length of 1) that represents the direction of the original vector. This property converts the integer vector into a floating-point vector, specifically a Vector2, to provide a normalized direction.

Usage

Use the Normal property when you need to obtain the direction of a Vector2Int as a unit vector. This is particularly useful in scenarios where the magnitude of the vector is not important, but the direction is. Note that the result is a Vector2, not a Vector2Int, due to the need for floating-point precision in representing unit vectors.

Example

Vector2Int vector = new Vector2Int(3, 4);
Vector2 normalizedVector = vector.Normal;
// normalizedVector now holds the unit vector equivalent of (3, 4)