float Degrees { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Degrees property of the Vector2 struct returns the angle of the vector in degrees. This angle is always between 0 and 360 degrees, providing a full circle representation of the vector's direction in 2D space. This property is useful for converting the vector's direction into a more human-readable format, such as when displaying angles in a user interface or performing calculations that require angle measurements.

Usage

To access the Degrees property, you need to have an instance of the Vector2 struct. This property is read-only and provides the angle of the vector in degrees. It is important to note that this property is marked with the JsonIgnore attribute, meaning it will not be serialized when using JSON serialization.

Example

Vector2 vector = new Vector2(1, 1);
float angleInDegrees = vector.Degrees;
// angleInDegrees will be 45.0f, as the vector (1, 1) forms a 45-degree angle with the x-axis.