diff options
Diffstat (limited to 'modules/mono/glue')
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs index 3dff37279b..d536b14eac 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs @@ -437,8 +437,11 @@ namespace Godot /// <returns>The rotated vector.</returns> public Vector2 Rotated(real_t phi) { - real_t rads = Angle() + phi; - return new Vector2(Mathf.Cos(rads), Mathf.Sin(rads)) * Length(); + real_t sine = Mathf.Sin(phi); + real_t cosi = Mathf.Cos(phi); + return new Vector2( + x * cosi - y * sine, + x * sine + y * cosi); } /// <summary> |