summaryrefslogtreecommitdiff
path: root/scene/2d/joint_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/joint_2d.cpp')
-rw-r--r--scene/2d/joint_2d.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/scene/2d/joint_2d.cpp b/scene/2d/joint_2d.cpp
index 0467c39746..c2773191ea 100644
--- a/scene/2d/joint_2d.cpp
+++ b/scene/2d/joint_2d.cpp
@@ -128,7 +128,7 @@ void Joint2D::set_node_a(const NodePath &p_node_a) {
return;
}
- if (joint.is_valid()) {
+ if (is_configured()) {
_disconnect_signals();
}
@@ -145,7 +145,7 @@ void Joint2D::set_node_b(const NodePath &p_node_b) {
return;
}
- if (joint.is_valid()) {
+ if (is_configured()) {
_disconnect_signals();
}
@@ -159,15 +159,18 @@ NodePath Joint2D::get_node_b() const {
void Joint2D::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_READY: {
+ case NOTIFICATION_POST_ENTER_TREE: {
+ if (is_configured()) {
+ _disconnect_signals();
+ }
_update_joint();
} break;
case NOTIFICATION_EXIT_TREE: {
- if (joint.is_valid()) {
+ if (is_configured()) {
_disconnect_signals();
- _update_joint(true);
}
+ _update_joint(true);
} break;
}
}
@@ -187,7 +190,9 @@ void Joint2D::set_exclude_nodes_from_collision(bool p_enable) {
if (exclude_from_collision == p_enable) {
return;
}
-
+ if (is_configured()) {
+ _disconnect_signals();
+ }
_update_joint(true);
exclude_from_collision = p_enable;
_update_joint();