From eb4ad50d9904ff0359e303708127d3d9ba68dab2 Mon Sep 17 00:00:00 2001 From: Jeffery Myers Date: Wed, 31 Dec 2025 14:52:08 -0800 Subject: [PATCH] make sure that our up vector really is up in an axis before picking a world plane (#5459) --- src/rcamera.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rcamera.h b/src/rcamera.h index 12f3a9e09..72552ec15 100644 --- a/src/rcamera.h +++ b/src/rcamera.h @@ -255,8 +255,8 @@ void CameraMoveForward(Camera *camera, float distance, bool moveInWorldPlane) if (moveInWorldPlane) { // Project vector onto world plane (the plane defined by the up vector) - if (fabsf(camera->up.z) > 0) forward.z = 0; - else if (fabsf(camera->up.x) > 0) forward.x = 0; + if (fabsf(camera->up.z) > 0.7071f) forward.z = 0; + else if (fabsf(camera->up.x) > 0.7071f) forward.x = 0; else forward.y = 0; forward = Vector3Normalize(forward); @@ -291,8 +291,8 @@ void CameraMoveRight(Camera *camera, float distance, bool moveInWorldPlane) if (moveInWorldPlane) { // Project vector onto world plane (the plane defined by the up vector) - if (fabsf(camera->up.z) > 0) right.z = 0; - else if (fabsf(camera->up.x) > 0) right.x = 0; + if (fabsf(camera->up.z) > 0.7071f) right.z = 0; + else if (fabsf(camera->up.x) > 0.7071f) right.x = 0; else right.y = 0; right = Vector3Normalize(right);