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 you need to perform operations that require direction without regard to magnitude, such as calculating angles or projecting vectors.

Example

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