Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Physics Interpolation 2D - fix light and light occluder resetting #89577

Merged
merged 1 commit into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion scene/2d/light_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,12 @@ void Light2D::_notification(int p_what) {
} break;
case NOTIFICATION_RESET_PHYSICS_INTERPOLATION: {
if (is_visible_in_tree() && is_physics_interpolated()) {
VisualServer::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.
VS::get_singleton()->canvas_light_set_transform(canvas_light, get_global_transform());
VS::get_singleton()->canvas_light_reset_physics_interpolation(canvas_light);
}
} break;
}
Expand Down
7 changes: 6 additions & 1 deletion scene/2d/light_occluder_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@ void LightOccluder2D::_notification(int p_what) {
} break;
case NOTIFICATION_RESET_PHYSICS_INTERPOLATION: {
if (is_visible_in_tree() && is_physics_interpolated()) {
VisualServer::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.
VS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform());
VS::get_singleton()->canvas_light_occluder_reset_physics_interpolation(occluder);
}
} break;
}
Expand Down
Loading