Moved quat to forward vector in math helper class

This commit is contained in:
Antoine Pilote
2023-07-09 23:51:32 -04:00
parent f66865c0ec
commit 2a6601a2db
3 changed files with 14 additions and 3 deletions

View File

@@ -16,6 +16,7 @@
#include <GL/glew.h>
#include "Engine.h"
#include "src/Core/Maths.h"
#include "src/Core/FileSystem.h"
#include "src/Scene/Components/Components.h"
#include "src/Scene/Components/BoxCollider.h"
@@ -141,10 +142,13 @@ namespace Nuake {
{
auto [transform, camera, parent] = view.get<TransformComponent, CameraComponent, ParentComponent>(e);
cam = camera.CameraInstance;
cam->Translation = transform.GetGlobalPosition();
cam->SetDirection(glm::rotate(glm::inverse(transform.GetGlobalRotation()), glm::vec3(1.0, 0.0, 0.0)));
camTransform = transform.GetGlobalTransform();
cam->Translation = transform.GetGlobalPosition();
const Vector3& forward = QuatToDirection(transform.GetGlobalRotation());
cam->SetDirection(forward);
camTransform = transform.GetGlobalTransform();
break;
}
}