diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-10-20 18:59:17 -0700 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-10-21 08:56:12 -0700 |
commit | e6f7235ffb49e94a876756a9295b907ce7fc834a (patch) | |
tree | a9440fe98642e894b0f045ba4f42acc1ebc781b8 /scene/3d | |
parent | fad7034e8b8275ce89424185c6ccee4de6aebd7f (diff) |
Fix SoftDynamicBody3D crash when setting disable mode
Proper logic for changing physics state when disabled and disabled mode
is changed (it was unnecessarily making calls to re-initialize physics).
Extra error handling in soft body implementations to avoid crashes with
invalid mesh.
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/soft_dynamic_body_3d.cpp | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/scene/3d/soft_dynamic_body_3d.cpp b/scene/3d/soft_dynamic_body_3d.cpp index 43292d42f1..903eedb58b 100644 --- a/scene/3d/soft_dynamic_body_3d.cpp +++ b/scene/3d/soft_dynamic_body_3d.cpp @@ -552,15 +552,9 @@ void SoftDynamicBody3D::set_disable_mode(DisableMode p_mode) { return; } - bool inside_tree = is_inside_tree(); - - if (inside_tree && (disable_mode == DISABLE_MODE_REMOVE)) { - _prepare_physics_server(); - } - disable_mode = p_mode; - if (inside_tree && (disable_mode == DISABLE_MODE_REMOVE)) { + if (mesh.is_valid() && is_inside_tree() && !is_enabled()) { _prepare_physics_server(); } } |