diff options
| author | Steven Schveighoffer <[email protected]> | 2021-12-06 13:05:28 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-06 19:05:28 +0100 |
| commit | fa7337e19c952137992c9d8733856c8f3c324fa6 (patch) | |
| tree | 908df353c4a611c4c7d2ff459806334285695f2f /src | |
| parent | 93f05d851d4412504d573e7cfb15c15c31b5b5c2 (diff) | |
| download | raylib-fa7337e19c952137992c9d8733856c8f3c324fa6.tar.gz raylib-fa7337e19c952137992c9d8733856c8f3c324fa6.zip | |
Vector2Angle returns degrees instead of radians, but all other raymath (#2193)
functions use radians, making this awkward to use.
Diffstat (limited to 'src')
| -rw-r--r-- | src/raymath.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/raymath.h b/src/raymath.h index 48846a7a..399c2f6c 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; } |
