diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-04 15:35:30 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-04 15:35:30 +0200 |
commit | 72cdb0b4c58803d09a6398b6e14744b740cf6566 (patch) | |
tree | d9ec02ead57646f38a254f7a1e1b9b61ff3f7acf /scene/3d/physics_body_3d.cpp | |
parent | 03ff9fedb60e6ee13b1340b127e624e2d9b875cc (diff) | |
parent | eff7f27c48faaee4de915db598705d7946d97a0f (diff) | |
download | redot-engine-72cdb0b4c58803d09a6398b6e14744b740cf6566.tar.gz |
Merge pull request #82393 from jrouwe/body_changed_state
Fix performance regression in RigidBody2D/3D and PhysicalBone3D
Diffstat (limited to 'scene/3d/physics_body_3d.cpp')
-rw-r--r-- | scene/3d/physics_body_3d.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 973d1cde58..a5f5ae6e61 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -502,9 +502,12 @@ void RigidBody3D::_body_state_changed(PhysicsDirectBodyState3D *p_state) { lock_callback(); set_ignore_transform_notification(true); - _sync_body_state(p_state); - GDVIRTUAL_CALL(_integrate_forces, p_state); + if (GDVIRTUAL_IS_OVERRIDDEN(_integrate_forces)) { + _sync_body_state(p_state); + + GDVIRTUAL_CALL(_integrate_forces, p_state); + } _sync_body_state(p_state); set_ignore_transform_notification(false); @@ -2935,9 +2938,12 @@ void PhysicalBone3D::_body_state_changed(PhysicsDirectBodyState3D *p_state) { } set_ignore_transform_notification(true); - _sync_body_state(p_state); - GDVIRTUAL_CALL(_integrate_forces, p_state); + if (GDVIRTUAL_IS_OVERRIDDEN(_integrate_forces)) { + _sync_body_state(p_state); + + GDVIRTUAL_CALL(_integrate_forces, p_state); + } _sync_body_state(p_state); set_ignore_transform_notification(false); |