From fa7337e19c952137992c9d8733856c8f3c324fa6 Mon Sep 17 00:00:00 2001 From: Steven Schveighoffer Date: Mon, 6 Dec 2021 13:05:28 -0500 Subject: [PATCH] Vector2Angle returns degrees instead of radians, but all other raymath (#2193) functions use radians, making this awkward to use. --- src/raymath.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/raymath.h b/src/raymath.h index 48846a7ad..399c2f6c0 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -281,9 +281,9 @@ RMAPI float Vector2Distance(Vector2 v1, Vector2 v2) // Calculate angle from two vectors in X-axis RMAPI float Vector2Angle(Vector2 v1, Vector2 v2) { - float result = atan2f(v2.y - v1.y, v2.x - v1.x)*(180.0f/PI); + float result = atan2f(v2.y - v1.y, v2.x - v1.x); - if (result < 0) result += 360.0f; + if (result < 0) result += 2 * PI; return result; }