summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphaelHunter <Raphael10241024@gmail.com>2019-11-14 15:48:41 +0800
committerRaphaelHunter <Raphael10241024@gmail.com>2019-11-14 15:48:41 +0800
commit8330e70e2cc935a92cf11862b68f6cfa0ce66fe8 (patch)
treeeae9c7d380cd1c7fac8c7c67f010c172d56fb227
parent14e52f7aeea449dc6cfa8861657b2e23cc34c560 (diff)
refresh area2d collision when shape changes, close #33369
-rw-r--r--servers/physics/area_sw.cpp3
-rw-r--r--servers/physics_2d/area_2d_sw.cpp3
2 files changed, 6 insertions, 0 deletions
diff --git a/servers/physics/area_sw.cpp b/servers/physics/area_sw.cpp
index ad3e40916d..16f2fa45ea 100644
--- a/servers/physics/area_sw.cpp
+++ b/servers/physics/area_sw.cpp
@@ -46,6 +46,9 @@ AreaSW::BodyKey::BodyKey(AreaSW *p_body, uint32_t p_body_shape, uint32_t p_area_
}
void AreaSW::_shapes_changed() {
+
+ if (!moved_list.in_list() && get_space())
+ get_space()->area_add_to_moved_list(&moved_list);
}
void AreaSW::set_transform(const Transform &p_transform) {
diff --git a/servers/physics_2d/area_2d_sw.cpp b/servers/physics_2d/area_2d_sw.cpp
index 9ec1eacd29..9275e8883f 100644
--- a/servers/physics_2d/area_2d_sw.cpp
+++ b/servers/physics_2d/area_2d_sw.cpp
@@ -46,6 +46,9 @@ Area2DSW::BodyKey::BodyKey(Area2DSW *p_body, uint32_t p_body_shape, uint32_t p_a
}
void Area2DSW::_shapes_changed() {
+
+ if (!moved_list.in_list() && get_space())
+ get_space()->area_add_to_moved_list(&moved_list);
}
void Area2DSW::set_transform(const Transform2D &p_transform) {