summaryrefslogtreecommitdiffstats
path: root/scene/2d/collision_object_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/collision_object_2d.cpp')
-rw-r--r--scene/2d/collision_object_2d.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index ba3b0cec5c..ab42c52913 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -118,6 +118,15 @@ void CollisionObject2D::_notification(int p_what) {
}
} break;
+ case NOTIFICATION_WORLD_2D_CHANGED: {
+ RID space = get_world_2d()->get_space();
+ if (area) {
+ PhysicsServer2D::get_singleton()->area_set_space(rid, space);
+ } else {
+ PhysicsServer2D::get_singleton()->body_set_space(rid, space);
+ }
+ } break;
+
case NOTIFICATION_DISABLED: {
_apply_disabled();
} break;