summaryrefslogtreecommitdiffstats
path: root/scene/3d/physics_body_3d.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-21 11:28:02 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-21 11:28:02 +0100
commit7b622ce6e8a40508dbfccb21380e5f0b2dd45fac (patch)
tree633abb4f920e5a365b8b781e5d6cbc91734b92f9 /scene/3d/physics_body_3d.cpp
parentd45af488c47a1ed1812e5b6c5c01beee4890e250 (diff)
parent398e73c689e8506933a066c6a8045a50f58d0c04 (diff)
downloadredot-engine-7b622ce6e8a40508dbfccb21380e5f0b2dd45fac.tar.gz
Merge pull request #71021 from reduz/prevent-physics-callback-removal
Error when removing a physics node during a physics callback
Diffstat (limited to 'scene/3d/physics_body_3d.cpp')
-rw-r--r--scene/3d/physics_body_3d.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 46956b0a2e..106efbc596 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -484,6 +484,8 @@ struct _RigidBodyInOut {
};
void RigidBody3D::_body_state_changed(PhysicsDirectBodyState3D *p_state) {
+ lock_callback();
+
set_ignore_transform_notification(true);
set_global_transform(p_state->get_transform());
@@ -578,6 +580,8 @@ void RigidBody3D::_body_state_changed(PhysicsDirectBodyState3D *p_state) {
contact_monitor->locked = false;
}
+
+ unlock_callback();
}
void RigidBody3D::_notification(int p_what) {