From 08a3c01f66da78839c59b132e4822f03ebb1b5e8 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 31 Mar 2022 15:31:53 -0700 Subject: [PATCH] add Vector2.Angle --- src/Math/Vector2.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Math/Vector2.cs b/src/Math/Vector2.cs index 30751663..b247ae07 100644 --- a/src/Math/Vector2.cs +++ b/src/Math/Vector2.cs @@ -204,6 +204,14 @@ namespace MoonWorks.Math Y *= val; } + /// + /// Turns this to an angle in radians. + /// + public float Angle() + { + return MathF.Atan2(Y, X); + } + /// /// Returns a representation of this in the format: /// {X:[] Y:[]}