Skip to content

Commit

Permalink
Improve navigation map synchronisation error msgs
Browse files Browse the repository at this point in the history
Improves navigation map synchronisation error msgs related to mismatch of cell sizes.
  • Loading branch information
smix8 committed Jun 3, 2023
1 parent c3e512e commit 7f24171
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/navigation/nav_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ void NavMap::sync() {
connections[ek].push_back(new_connection);
} else {
// The edge is already connected with another edge, skip.
ERR_PRINT_ONCE("Attempted to merge a navigation mesh triangle edge with another already-merged edge. This happens when the current `cell_size` is different from the one used to generate the navigation mesh. This will cause navigation problems.");
ERR_PRINT_ONCE("Navigation map synchronization error. Attempted to merge a navigation mesh polygon edge with another already-merged edge. This is usually caused by crossing edges, overlapping polygons, or a mismatch of the NavigationMesh / NavigationPolygon baked 'cell_size' and navigation map 'cell_size'.");
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions modules/navigation/nav_region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ void NavRegion::update_polygons() {
return;
}

if (!Math::is_equal_approx(double(map->get_cell_size()), double(mesh->get_cell_size()))) {
ERR_PRINT_ONCE("Navigation map synchronization error. Attempted to update a navigation region with a navigation mesh that uses a different `cell_size` than the `cell_size` set on the navigation map.");
}

Vector<Vector3> vertices = mesh->get_vertices();
int len = vertices.size();
if (len == 0) {
Expand Down

0 comments on commit 7f24171

Please sign in to comment.