Fix: make nav_map_2d uses rasterizer cell scale options in 2d navigation settings

This commit is contained in:
notgoyome
2025-06-21 02:42:10 +02:00
parent 4e6ac9bccc
commit e37efa8722
9 changed files with 45 additions and 1 deletions

View File

@@ -353,6 +353,20 @@ real_t GodotNavigationServer2D::map_get_cell_size(RID p_map) const {
return map->get_cell_size();
}
COMMAND_2(map_set_merge_rasterizer_cell_scale, RID, p_map, float, p_value) {
NavMap2D *map = map_owner.get_or_null(p_map);
ERR_FAIL_NULL(map);
map->set_merge_rasterizer_cell_scale(p_value);
}
float GodotNavigationServer2D::map_get_merge_rasterizer_cell_scale(RID p_map) const {
NavMap2D *map = map_owner.get_or_null(p_map);
ERR_FAIL_NULL_V(map, false);
return map->get_merge_rasterizer_cell_scale();
}
COMMAND_2(map_set_use_edge_connections, RID, p_map, bool, p_enabled) {
NavMap2D *map = map_owner.get_or_null(p_map);
ERR_FAIL_NULL(map);

View File

@@ -115,6 +115,9 @@ public:
COMMAND_2(map_set_cell_size, RID, p_map, real_t, p_cell_size);
virtual real_t map_get_cell_size(RID p_map) const override;
COMMAND_2(map_set_merge_rasterizer_cell_scale, RID, p_map, float, p_value);
virtual float map_get_merge_rasterizer_cell_scale(RID p_map) const override;
COMMAND_2(map_set_use_edge_connections, RID, p_map, bool, p_enabled);
virtual bool map_get_use_edge_connections(RID p_map) const override;

View File

@@ -137,7 +137,7 @@ void NavMapBuilder2D::_build_step_find_edge_connection_pairs(NavMapIterationBuil
} else {
// The edge is already connected with another edge, skip.
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'. If you're certain none of above is the case, change 'navigation/3d/merge_rasterizer_cell_scale' to 0.001.");
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'. If you're certain none of above is the case, change 'navigation/2d/merge_rasterizer_cell_scale' to 0.001.");
}
}
}