Prevent errors when drawing debug meshes when surface count is zero.
Adds a few checks to ensure a debug collision mesh contains mesh data before attempting to add it to the gizmo draw list. This prevents errors when using SeparationRayShape3D, which is only intended to draw a single line, and contains no mesh data. Closes #100665
This commit is contained in:
@@ -350,7 +350,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
||||
|
||||
if (cs->get_debug_fill_enabled()) {
|
||||
Ref<ArrayMesh> array_mesh = s->get_debug_arraymesh_faces(collision_color);
|
||||
if (array_mesh.is_valid()) {
|
||||
if (array_mesh.is_valid() && array_mesh->get_surface_count() > 0) {
|
||||
p_gizmo->add_mesh(array_mesh, material_arraymesh);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user