diff --git a/modules/tile_map/tile_map.cpp b/modules/tile_map/tile_map.cpp index 5cb1e419d..a17799b0e 100644 --- a/modules/tile_map/tile_map.cpp +++ b/modules/tile_map/tile_map.cpp @@ -135,6 +135,17 @@ void TileMap::_notification(int p_what) { } } break; + + case NOTIFICATION_RESET_PHYSICS_INTERPOLATION: { + if (is_visible_in_tree() && is_physics_interpolated_and_enabled()) { + for (Map::Element *E = quadrant_map.front(); E; E = E->next()) { + Quadrant &q = E->get(); + for (List::Element *F = q.canvas_items.front(); F; F = F->next()) { + VisualServer::get_singleton()->canvas_item_reset_physics_interpolation(F->get()); + } + } + } + } break; } } @@ -801,6 +812,13 @@ void TileMap::update_dirty_quadrants() { RenderingServerCanvasHelper::tilemap_end(); } + // Reset physics interpolation for any recreated canvas items. + if (is_physics_interpolated_and_enabled() && is_visible_in_tree()) { + for (List::Element *F = q.canvas_items.front(); F; F = F->next()) { + VisualServer::get_singleton()->canvas_item_reset_physics_interpolation(F->get()); + } + } + dirty_quadrant_list.remove(dirty_quadrant_list.first()); quadrant_order_dirty = true; } diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 19ee1e6ab..316d699cd 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -318,6 +318,15 @@ void Camera2D::_notification(int p_what) { make_current(); } + // Note that NOTIFICATION_RESET_PHYSICS_INTERPOLATION + // is automatically called before this because Camera2D is inherited + // from CanvasItem. However, the camera transform is not up to date + // until this point, so we do an extra manual reset. + if (is_physics_interpolated_and_enabled()) { + _interpolation_data.xform_curr = get_camera_transform(); + _interpolation_data.xform_prev = _interpolation_data.xform_curr; + } + first = true; } break; case NOTIFICATION_EXIT_TREE: {