Преглед на файлове

Fixed Timestep Interpolation: Fix behaviour on pause

Co-authored-by: lawnjelly <[email protected]>
Ricardo Buring преди 1 година
родител
ревизия
ceadbaa299
променени са 2 файла, в които са добавени 12 реда и са изтрити 0 реда
  1. 6 0
      scene/2d/camera_2d.cpp
  2. 6 0
      scene/main/node.cpp

+ 6 - 0
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();

+ 6 - 0
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);