Limit should only be positive, because it's the length
This commit is contained in:
parent
41e2c50ab8
commit
89d2a38c0c
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user