The Vector2.FromRadians
method creates a 2D vector from a given angle in radians. This method is useful for converting an angle into a directional vector, which can be used in various mathematical and graphical computations.
The Vector2.FromRadians
method creates a 2D vector from a given angle in radians. This method is useful for converting an angle into a directional vector, which can be used in various mathematical and graphical computations.
To use the FromRadians
method, call it with a single parameter representing the angle in radians. The method returns a Vector2
object where the x and y components are derived from the cosine and sine of the angle, respectively.
// Example of using Vector2.FromRadians float angleInRadians = 1.5708f; // 90 degrees in radians Vector2 direction = Vector2.FromRadians(angleInRadians); // direction will be approximately (0, 1)