From e0bdb19a62f532697c83c571254691eecb330e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20=27dreamsComeTrue=27=20Jasi=C5=84ski?= Date: Sat, 17 Oct 2020 17:00:39 +0200 Subject: [PATCH] Fix camera2d zoom when set to zero (causing ERROR: affine_invert: Condition ' det == 0 ' is true.) Fixes: #41873 (cherry picked from commit aba477361d02da485076c873b29b06e10f17f279) --- scene/2d/camera_2d.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 50d87a7489..4c3cd3fa0f 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -78,6 +78,8 @@ 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;