From 10989809522b9dd4d78ced4e46b50bb57396d570 Mon Sep 17 00:00:00 2001 From: The4codeblocks <72419529+The4codeblocks@users.noreply.github.com> Date: Fri, 23 Jan 2026 07:59:19 -0500 Subject: [PATCH] the math in QuaternionFromVector3ToVector3 is wrong --- src/raymath.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/raymath.h b/src/raymath.h index 7b58d410e..2ce404bd6 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -2369,7 +2369,7 @@ RMAPI Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to) result.x = cross.x; result.y = cross.y; result.z = cross.z; - result.w = 1.0f + cos2Theta; + result.w = sqrtf(cross.x * cross.x + cross.y * cross.y + cross.z * cross.z + cos2Theta * cos2Theta) + cos2Theta; // sqrtf(Vector3DotProduct(cross, cross) + cos2Theta * cos2Theta) + cos2Theta // QuaternionNormalize(q); // NOTE: Normalize to essentially nlerp the original and identity to 0.5