diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-10-22 12:52:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-22 12:52:12 +0200 |
commit | bd23cce055334704dac503f12451df8bd259b751 (patch) | |
tree | 22e97dc3c235778c71039cab6ee3249c4f47948e /scene/2d | |
parent | 3aa5b54330adf334c868a6ec53d5b5450689506c (diff) | |
parent | 0de76cc647cb5cec2bec00f60bf5383f4354ae67 (diff) |
Merge pull request #32896 from nekomatata/joint-reset-collision
Properly reset collision exception when releasing Joint2D
Diffstat (limited to 'scene/2d')
-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 12fb18cedc..847d08b025 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(); @@ -131,6 +131,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(); } |