diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2019-10-17 19:22:41 +0200 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2019-10-17 19:22:59 +0200 |
commit | 0de76cc647cb5cec2bec00f60bf5383f4354ae67 (patch) | |
tree | cf47525fcd627b0e7f04d36f7e7c75a9aba054fd /scene | |
parent | 26bbb26738ec94d2f74ad866b79e5f44ca62ca75 (diff) |
Properly reset collision exception when releasing Joint2D
Now using joint_disable_collisions_between_bodies() to reset the exception, because body_remove_collision_exception() was doing only a part of the work.
Fixes #32733
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/joints_2d.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp index d8156a0afe..ab1c7c77e7 100644 --- a/scene/2d/joints_2d.cpp +++ b/scene/2d/joints_2d.cpp @@ -37,8 +37,8 @@ void Joint2D::_update_joint(bool p_only_free) { if (joint.is_valid()) { - if (ba.is_valid() && bb.is_valid()) - Physics2DServer::get_singleton()->body_remove_collision_exception(ba, bb); + if (ba.is_valid() && bb.is_valid() && exclude_from_collision) + Physics2DServer::get_singleton()->joint_disable_collisions_between_bodies(joint, false); Physics2DServer::get_singleton()->free(joint); joint = RID(); @@ -133,6 +133,8 @@ void Joint2D::set_exclude_nodes_from_collision(bool p_enable) { if (exclude_from_collision == p_enable) return; + + _update_joint(true); exclude_from_collision = p_enable; _update_joint(); } |