summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-12-01 22:20:04 +0100
committerGitHub <noreply@github.com>2019-12-01 22:20:04 +0100
commite9b709a5dbbe46d73b121f595cceb08ca31fcc36 (patch)
treeb33d9d43bf6334dfd45432cb1e03a626bfc3db93 /scene
parentad95424dbace10d0ea1770e22bb1cd85463d18ab (diff)
parentfdd99d4a7c60e3ae5aed41d78685ad50d3399220 (diff)
Merge pull request #34047 from nekomatata/physical-bone-remove-joint
Properly remove joint when a physical bone is removed from the scene
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/physics_body.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index a107c3bf7a..2c0e6ee744 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -2161,6 +2161,9 @@ void PhysicalBone::_notification(int p_what) {
update_bone_id();
reset_to_rest_position();
_reset_physics_simulation_state();
+ if (!joint.is_valid() && joint_data) {
+ _reload_joint();
+ }
break;
case NOTIFICATION_EXIT_TREE:
if (parent_skeleton) {
@@ -2169,7 +2172,10 @@ void PhysicalBone::_notification(int p_what) {
}
}
parent_skeleton = NULL;
- update_bone_id();
+ if (joint.is_valid()) {
+ PhysicsServer::get_singleton()->free(joint);
+ joint = RID();
+ }
break;
case NOTIFICATION_TRANSFORM_CHANGED:
if (Engine::get_singleton()->is_editor_hint()) {