From f2c022dbd1a179d51c03c68fa0e7ad7d71b5c97c Mon Sep 17 00:00:00 2001 From: Steven Schveighoffer Date: Mon, 6 Dec 2021 13:02:15 -0500 Subject: [PATCH] Vector2Angle returns degrees instead of radians, but all other raymath 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; }