Skip to content

Commit

Permalink
Avoid adding a null collision shape, this can happen with empty brush…
Browse files Browse the repository at this point in the history
… entities (fixes #32)
  • Loading branch information
codecat committed Oct 1, 2022
1 parent 5d507cd commit 81dff6d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@ void Builder::add_collider_from_mesh(Node3D* node, Ref<ArrayMesh>& mesh, Collide
case ColliderShape::Concave: mesh_shape = mesh->create_trimesh_shape(); break;
}

if (mesh_shape == nullptr) {
UtilityFunctions::printerr("Unable to create collider shape from mesh!");
return;
}

auto collision_shape = memnew(CollisionShape3D());
collision_shape->set_shape(mesh_shape);
node->add_child(collision_shape, true);
Expand Down

0 comments on commit 81dff6d

Please sign in to comment.