Parcourir la source

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

pull/5459/head
Jeffery Myers il y a 1 mois
committed by GitHub
Parent
révision
0133a4e6c6
Aucune clé connue n'a été trouvée dans la base pour cette signature ID de la clé GPG: B5690EEEBB952194
1 fichiers modifiés avec 15 ajouts et 4 suppressions
  1. +15
    -4
      src/rcamera.h

+ 15
- 4
src/rcamera.h Voir le fichier

@ -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);
}

Chargement…
Annuler
Enregistrer