Correcting camera orientation
This commit is contained in:
@@ -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); }
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user