Make CameraMove up and right work with Z up cameras like the other functions do. (#5458)

This commit is contained in:
Jeffery Myers
2025-12-31 11:45:29 -08:00
committed by GitHub
parent c124f2552b
commit 0133a4e6c6

View File

@ -252,7 +252,12 @@ void CameraMoveForward(Camera *camera, float distance, bool moveInWorldPlane)
if (moveInWorldPlane)
{
// Project vector onto world plane
// 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
// 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);
}