Skip to content

Commit 50e24e2

Browse files
committed
Fix crash when disabling SoftBody3D while using Jolt Physics
1 parent 9a39760 commit 50e24e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/jolt_physics/objects/jolt_soft_body_3d.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ JPH::ObjectLayer JoltSoftBody3D::_get_object_layer() const {
7474
void JoltSoftBody3D::_space_changing() {
7575
JoltObject3D::_space_changing();
7676

77-
if (in_space()) {
77+
// Note that we should not use `in_space()` as the condition here, since we could have cleared the mesh at this point.
78+
if (jolt_body != nullptr) {
7879
jolt_settings = new JPH::SoftBodyCreationSettings(jolt_body->GetSoftBodyCreationSettings());
7980
jolt_settings->mSettings = nullptr;
8081
}

0 commit comments

Comments
 (0)