|
@@ -168,14 +168,17 @@ NodePath Joint2D::get_node_b() const {
|
|
|
|
|
|
void Joint2D::_notification(int p_what) {
|
|
|
switch (p_what) {
|
|
|
- case NOTIFICATION_READY: {
|
|
|
+ case NOTIFICATION_POST_ENTER_TREE: {
|
|
|
+ if (joint.is_valid()) {
|
|
|
+ _disconnect_signals();
|
|
|
+ }
|
|
|
_update_joint();
|
|
|
} break;
|
|
|
case NOTIFICATION_EXIT_TREE: {
|
|
|
if (joint.is_valid()) {
|
|
|
_disconnect_signals();
|
|
|
- _update_joint(true);
|
|
|
}
|
|
|
+ _update_joint(true);
|
|
|
} break;
|
|
|
}
|
|
|
}
|
|
@@ -195,7 +198,9 @@ void Joint2D::set_exclude_nodes_from_collision(bool p_enable) {
|
|
|
if (exclude_from_collision == p_enable) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+ if (joint.is_valid()) {
|
|
|
+ _disconnect_signals();
|
|
|
+ }
|
|
|
_update_joint(true);
|
|
|
exclude_from_collision = p_enable;
|
|
|
_update_joint();
|