Skip to content

Commit

Permalink
Fix Vector3ClampValue and Vector2ClampValue (#2585)
Browse files Browse the repository at this point in the history
Co-authored-by: Timofffee <[email protected]>
  • Loading branch information
Timofffee and Timofffee authored Jul 20, 2022
1 parent 4a9391a commit b40696e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/raymath.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b40696e

Please sign in to comment.