summaryrefslogtreecommitdiffstats
path: root/scene/2d/light_occluder_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/light_occluder_2d.cpp')
-rw-r--r--scene/2d/light_occluder_2d.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp
index 61f5d5cd46..092c987ac0 100644
--- a/scene/2d/light_occluder_2d.cpp
+++ b/scene/2d/light_occluder_2d.cpp
@@ -158,6 +158,10 @@ void LightOccluder2D::_poly_changed() {
#endif
}
+void LightOccluder2D::_physics_interpolated_changed() {
+ RenderingServer::get_singleton()->canvas_light_occluder_set_interpolated(occluder, is_physics_interpolated());
+}
+
void LightOccluder2D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_CANVAS: {
@@ -199,6 +203,17 @@ void LightOccluder2D::_notification(int p_what) {
case NOTIFICATION_EXIT_CANVAS: {
RS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder, RID());
} break;
+
+ case NOTIFICATION_RESET_PHYSICS_INTERPOLATION: {
+ if (is_visible_in_tree() && is_physics_interpolated()) {
+ // Explicitly make sure the transform is up to date in RenderingServer 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;
}
}