diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2018-07-09 21:07:15 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2018-07-09 21:07:15 +0200 |
commit | ec5c96dbe11f3f62f7a47204d65392ff25b5a62a (patch) | |
tree | a5c0b8c59fb216b571c7a164e3e438170f63bc12 | |
parent | 149c6709897db45bfc7107fa1c56dbf1630a7857 (diff) |
Fix camera offsets not applied always
Specifically, project/unproject methods weren't taking them into account. Frustum computation may be affected as well.
This commit considers them for the camera matrix at all times.
-rw-r--r-- | scene/3d/camera.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index e11e8abe5b..90f5659f9f 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -74,10 +74,7 @@ void Camera::_update_camera() { if (!is_inside_tree()) return; - Transform tr = get_camera_transform(); - tr.origin += tr.basis.get_axis(1) * v_offset; - tr.origin += tr.basis.get_axis(0) * h_offset; - VisualServer::get_singleton()->camera_set_transform(camera, tr); + VisualServer::get_singleton()->camera_set_transform(camera, get_camera_transform()); // here goes listener stuff /* @@ -143,7 +140,10 @@ void Camera::_notification(int p_what) { Transform Camera::get_camera_transform() const { - return get_global_transform().orthonormalized(); + Transform tr = get_global_transform().orthonormalized(); + tr.origin += tr.basis.get_axis(1) * v_offset; + tr.origin += tr.basis.get_axis(0) * h_offset; + return tr; } void Camera::set_perspective(float p_fovy_degrees, float p_z_near, float p_z_far) { |