From 0133a4e6c6966e71567ecd663a1cdf43413042f5 Mon Sep 17 00:00:00 2001 From: Jeffery Myers Date: Wed, 31 Dec 2025 11:45:29 -0800 Subject: [PATCH] Make CameraMove up and right work with Z up cameras like the other functions do. (#5458) --- src/rcamera.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/rcamera.h b/src/rcamera.h index 3e9f83095..d67669a7b 100644 --- a/src/rcamera.h +++ b/src/rcamera.h @@ -252,8 +252,13 @@ void CameraMoveForward(Camera *camera, float distance, bool moveInWorldPlane) if (moveInWorldPlane) { - // Project vector onto world plane - forward.y = 0; + // 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; + else + forward.y = 0; forward = Vector3Normalize(forward); } @@ -285,8 +290,14 @@ void CameraMoveRight(Camera *camera, float distance, bool moveInWorldPlane) if (moveInWorldPlane) { - // Project vector onto world plane - right.y = 0; + // 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; + else + right.y = 0; + right = Vector3Normalize(right); }