summaryrefslogtreecommitdiff
path: root/scene/2d/joints_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/joints_2d.cpp')
-rw-r--r--scene/2d/joints_2d.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index f4f08674c9..7d9cdd52ac 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -49,19 +49,9 @@ void Joint2D::_disconnect_signals() {
}
}
-void Joint2D::_body_exit_tree(const ObjectID &p_body_id) {
+void Joint2D::_body_exit_tree() {
_disconnect_signals();
- Object *object = ObjectDB::get_instance(p_body_id);
- PhysicsBody2D *body = Object::cast_to<PhysicsBody2D>(object);
- ERR_FAIL_NULL(body);
- RID body_rid = body->get_rid();
- if (ba == body_rid) {
- a = NodePath();
- }
- if (bb == body_rid) {
- b = NodePath();
- }
- _update_joint();
+ _update_joint(true);
}
void Joint2D::_update_joint(bool p_only_free) {
@@ -142,8 +132,8 @@ void Joint2D::_update_joint(bool p_only_free) {
ba = body_a->get_rid();
bb = body_b->get_rid();
- body_a->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint2D::_body_exit_tree), make_binds(body_a->get_instance_id()));
- body_b->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint2D::_body_exit_tree), make_binds(body_b->get_instance_id()));
+ body_a->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint2D::_body_exit_tree));
+ body_b->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Joint2D::_body_exit_tree));
PhysicsServer2D::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision);
}