From ceadbaa29948be354eb20d75cf9dd1ebbda32260 Mon Sep 17 00:00:00 2001 From: Ricardo Buring Date: Sun, 7 Jul 2024 16:48:17 +0200 Subject: [PATCH] Fixed Timestep Interpolation: Fix behaviour on pause Co-authored-by: lawnjelly --- scene/2d/camera_2d.cpp | 6 ++++++ scene/main/node.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 514c5e7a8f8..7020d162feb 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -302,6 +302,12 @@ void Camera2D::_notification(int p_what) { _interpolation_data.xform_prev = _interpolation_data.xform_curr; } break; + case NOTIFICATION_PAUSED: { + if (is_physics_interpolated_and_enabled()) { + _update_scroll(); + } + } break; + case NOTIFICATION_TRANSFORM_CHANGED: { if ((!position_smoothing_enabled && !is_physics_interpolated_and_enabled()) || _is_editing_in_editor()) { _update_scroll(); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 5bbf8ebff43..0396f3ab4af 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -177,6 +177,12 @@ void Node::_notification(int p_notification) { } } break; + case NOTIFICATION_PAUSED: { + if (is_physics_interpolated_and_enabled() && is_inside_tree()) { + reset_physics_interpolation(); + } + } break; + case NOTIFICATION_PATH_RENAMED: { if (data.path_cache) { memdelete(data.path_cache);