summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik 'dreamsComeTrue' Jasiński <dominikjasinski@o2.pl>2020-10-17 17:00:39 +0200
committerDominik 'dreamsComeTrue' Jasiński <dominikjasinski@o2.pl>2020-12-16 23:42:12 +0100
commitaba477361d02da485076c873b29b06e10f17f279 (patch)
treedfe4f2d752adb3f03c61937eb1923dba1af75bd4
parentc514cc58224e5c973ac8be7bb6db7023d5c25906 (diff)
Fix camera2d zoom when set to zero (causing ERROR: affine_invert: Condition ' det == 0 ' is true.)
Fixes: #41873
-rw-r--r--scene/2d/camera_2d.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 79b0b64efb..0d09d21a71 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -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();