summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGeorge Linkovsky <[email protected]>2022-07-20 16:46:11 +0400
committerGitHub <[email protected]>2022-07-20 14:46:11 +0200
commitb40696eab6f47d3d8b1296221cec394a2dd56855 (patch)
tree36d9f015d378956cf909762e70ed9561b805c0e1
parent4a9391ae83757afd86b6f1cccae4335c611b5b41 (diff)
downloadraylib-b40696eab6f47d3d8b1296221cec394a2dd56855.tar.gz
raylib-b40696eab6f47d3d8b1296221cec394a2dd56855.zip
Fix Vector3ClampValue and Vector2ClampValue (#2585)
Co-authored-by: Timofffee <[email protected]>
-rw-r--r--src/raymath.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/raymath.h b/src/raymath.h
index f17800a7..22fa1442 100644
--- a/src/raymath.h
+++ b/src/raymath.h
@@ -457,7 +457,7 @@ RMAPI Vector2 Vector2Clamp(Vector2 v, Vector2 min, Vector2 max)
// Clamp the magnitude of the vector between two min and max values
RMAPI Vector2 Vector2ClampValue(Vector2 v, float min, float max)
{
- Vector2 result = { 0 };
+ Vector2 result = v;
float length = (v.x*v.x) + (v.y*v.y);
if (length > 0.0f)
@@ -951,7 +951,7 @@ RMAPI Vector3 Vector3Clamp(Vector3 v, Vector3 min, Vector3 max)
// Clamp the magnitude of the vector between two values
RMAPI Vector3 Vector3ClampValue(Vector3 v, float min, float max)
{
- Vector3 result = { 0 };
+ Vector3 result = v;
float length = (v.x*v.x) + (v.y*v.y) + (v.z*v.z);
if (length > 0.0f)