mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-09 21:18:44 +01:00
make sure that our up vector really is up in an axis before picking a world plane (#5459)
This commit is contained in:
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user