summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorRicardo Buring <ricardo.buring@gmail.com>2022-02-28 22:21:32 +0100
committerRicardo Buring <ricardo.buring@gmail.com>2022-02-28 22:21:32 +0100
commit9e100c3e7a38fa0a8338809729e4677e5c8e8edb (patch)
tree11e6d210a854f51a661c506b0e451da007d9ba4b /scene/2d
parent039ffda9917205428747eedc125d60afbc48993f (diff)
Joint2D and Joint3D: update joint on NOTIFICATION_POST_ENTER_TREE
This allows reparenting, etc.
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/joint_2d.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/scene/2d/joint_2d.cpp b/scene/2d/joint_2d.cpp
index 521efe6567..623e643333 100644
--- a/scene/2d/joint_2d.cpp
+++ b/scene/2d/joint_2d.cpp
@@ -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 (is_configured()) {
_disconnect_signals();
- _update_joint(true);
}
+ _update_joint(true);
} break;
}
}
@@ -187,7 +190,6 @@ 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();