diff --git a/src/raymath.h b/src/raymath.h index 352c29e5c..97149625b 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -99,8 +99,7 @@ // Types and Structures Definition //---------------------------------------------------------------------------------- #if !defined(RL_VECTOR2_TYPE) -// -type +// Vector2 type typedef struct Vector2 { float x; float y; @@ -534,10 +533,12 @@ RMAPI float Vector3Distance(Vector3 v1, Vector3 v2) // Calculate angle between two vectors RMAPI float Vector3Angle(Vector3 v1, Vector3 v2) { + float result = 0.0f; + Vector3 cross = { v1.y*v2.z - v1.z*v2.y, v1.z*v2.x - v1.x*v2.z, v1.x*v2.y - v1.y*v2.x }; float len = sqrtf(cross.x*cross.x + cross.y*cross.y + cross.z*cross.z); float dot = (v1.x*v2.x + v1.y*v2.y + v1.z*v2.z); - float result = atan2f(len, dot); + result = atan2f(len, dot); return result; }