From 89d2a38c0c25080b62a7071f26da5c815394352a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Bispo?= Date: Mon, 16 Sep 2024 15:43:50 -0300 Subject: [PATCH] Limit should only be positive, because it's the length --- src/raymath.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/raymath.h b/src/raymath.h index 539617ff9..f32d0553d 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -397,7 +397,7 @@ RMAPI Vector2 Vector2Normalize(Vector2 v) RMAPI Vector2 Vector2Limit(Vector2 v, float limit) { Vector2 result = {v.x, x.y}; float length = sqrtf((v.x * v.x) + (v.y * v.y)) - if (length > limit) { + if (length > limit && limit > 0) { float ilength = 1.0f/length; result.x = v.x*ilength*limit; result.y = v.y*ilength*limit;