Skip to content

Commit

Permalink
Fix camera2d zoom when set to zero (causing ERROR: affine_invert: Con…
Browse files Browse the repository at this point in the history
…dition ' det == 0 ' is true.)

Fixes: godotengine#41873
  • Loading branch information
dreamsComeTrue committed Dec 16, 2020
1 parent c514cc5 commit aba4773
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scene/2d/camera_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ void Camera2D::_update_process_mode() {
}

void Camera2D::set_zoom(const Vector2 &p_zoom) {
// Setting zoom to zero causes 'affine_invert' issues
ERR_FAIL_COND_MSG(Math::is_zero_approx(p_zoom.x) || Math::is_zero_approx(p_zoom.y), "Zoom level must be different from 0 (can be negative).");

zoom = p_zoom;
Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll();
Expand Down

0 comments on commit aba4773

Please sign in to comment.