From a124d89f0158b904c7eb6db573c81da1efbea397 Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Thu, 28 Jul 2022 11:48:53 +0100 Subject: [PATCH 1/2] When Camera2D enters tree, ensure first update is not lost --- scene/2d/camera_2d.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 37cc96e82f9..9898b7325a6 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -254,9 +254,8 @@ void Camera2D::_notification(int p_what) { // if a camera enters the tree that is set to current, // it should take over as the current camera, and mark // all other cameras as non current - _set_current(current); - first = true; + _set_current(current); } break; case NOTIFICATION_EXIT_TREE: { From d000a5fa308f0a1b81abc90cd60d1d1d3e2102b8 Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Thu, 28 Jul 2022 12:06:45 +0100 Subject: [PATCH 2/2] Ensure changes to Camera2D's limits don't affect smoothed_camera_pos --- 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 9898b7325a6..9dea44d72f6 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -436,7 +436,9 @@ void Camera2D::clear_current() { void Camera2D::set_limit(Margin p_margin, int p_limit) { ERR_FAIL_INDEX((int)p_margin, 4); limit[p_margin] = p_limit; + Point2 old_smoothed_camera_pos = smoothed_camera_pos; _update_scroll(); + smoothed_camera_pos = old_smoothed_camera_pos; } int Camera2D::get_limit(Margin p_margin) const {