From db06810a1db8684e246f1d844fe965203aa3b3b8 Mon Sep 17 00:00:00 2001 From: jdeokkim Date: Tue, 7 Dec 2021 13:54:26 +0900 Subject: [PATCH] Fix Vector2Angle() not working as expected --- src/raymath.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/raymath.h b/src/raymath.h index 624116d46263..401b16f444c3 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -281,7 +281,7 @@ 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); + float result = atan2f(v2.y, v2.x) - atan2f(v1.y, v1.x); if (result < 0) result += 2 * PI;