diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index 55b8e8020..4652685f9 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -320,7 +320,12 @@ void Light2D::_notification(int p_what) { } break; case NOTIFICATION_RESET_PHYSICS_INTERPOLATION: { if (is_visible_in_tree() && is_physics_interpolated()) { - RenderingServer::get_singleton()->canvas_light_reset_physics_interpolation(canvas_light); + // Explicitly make sure the transform is up to date in VisualServer before + // resetting. This is necessary because NOTIFICATION_TRANSFORM_CHANGED + // is normally deferred, and a client change to transform will not always be sent + // before the reset, so we need to guarantee this. + RS::get_singleton()->canvas_light_set_transform(canvas_light, get_global_transform()); + RS::get_singleton()->canvas_light_reset_physics_interpolation(canvas_light); } } break; } diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index d38fb1e45..007f3109e 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -203,7 +203,12 @@ void LightOccluder2D::_notification(int p_what) { } break; case NOTIFICATION_RESET_PHYSICS_INTERPOLATION: { if (is_visible_in_tree() && is_physics_interpolated()) { - RenderingServer::get_singleton()->canvas_light_occluder_reset_physics_interpolation(occluder); + // Explicitly make sure the transform is up to date in VisualServer before + // resetting. This is necessary because NOTIFICATION_TRANSFORM_CHANGED + // is normally deferred, and a client change to transform will not always be sent + // before the reset, so we need to guarantee this. + RS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform()); + RS::get_singleton()->canvas_light_occluder_reset_physics_interpolation(occluder); } } break; }