Fixed wrong camera rotation when global rotation is set

This commit is contained in:
Antoine Pilote
2023-07-09 23:44:50 -04:00
parent a8e9beafbb
commit f66865c0ec
3 changed files with 3 additions and 8 deletions

View File

@@ -142,7 +142,7 @@ namespace Nuake {
auto [transform, camera, parent] = view.get<TransformComponent, CameraComponent, ParentComponent>(e);
cam = camera.CameraInstance;
cam->Translation = transform.GetGlobalPosition();
cam->SetDirection(Vector3(Vector4(0, 0, -1, 0) * transform.GetGlobalTransform()));
cam->SetDirection(glm::rotate(glm::inverse(transform.GetGlobalRotation()), glm::vec3(1.0, 0.0, 0.0)));
camTransform = transform.GetGlobalTransform();
break;