Correcting camera orientation

This commit is contained in:
Dynamitos
2025-04-12 14:24:05 +02:00
parent 9ac3755ad3
commit 32ad82dbd2
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ void Transform::setScale(Vector s) { scale = Vector4(s, 0); }
Vector Transform::getForward() const { return glm::normalize(Vector(0, 0, 1) * rotation); }
Vector Transform::getRight() const { return glm::normalize(Vector(1, 0, 0) * rotation); }
Vector Transform::getRight() const { return glm::normalize(Vector(-1, 0, 0) * rotation); }
Vector Transform::getUp() const { return glm::normalize(Vector(0, 1, 0) * rotation); }
+2 -2
View File
@@ -9,6 +9,6 @@ CameraUpdater::~CameraUpdater() {}
void CameraUpdater::update(Component::Camera& camera, Component::Transform& transform) {
Vector eyePos = transform.getPosition();
Vector lookAt = eyePos + transform.getForward();
camera.viewMatrix = glm::lookAt(eyePos, lookAt, Vector(0, 1, 0));
Vector lookAt = eyePos - transform.getForward();
camera.viewMatrix = glm::lookAtLH(eyePos, lookAt, Vector(0, 1, 0));
}