浏览代码

Merge pull request #103735 from wagnerfs/fixes-navmesh-border-size-precision-warning

Fix navmesh `border_size` precision warnings
Rémi Verschelde 3 月之前
父节点
当前提交
6d08aa4504
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      modules/navigation_3d/3d/nav_mesh_generator_3d.cpp

+ 1 - 1
modules/navigation_3d/3d/nav_mesh_generator_3d.cpp

@@ -327,7 +327,7 @@ void NavMeshGenerator3D::generator_bake_from_source_geometry_data(Ref<Navigation
 	cfg.detailSampleDist = MAX(p_navigation_mesh->get_cell_size() * p_navigation_mesh->get_detail_sample_distance(), 0.1f);
 	cfg.detailSampleMaxError = p_navigation_mesh->get_cell_height() * p_navigation_mesh->get_detail_sample_max_error();
 
-	if (p_navigation_mesh->get_border_size() > 0.0 && Math::fmod(p_navigation_mesh->get_border_size(), p_navigation_mesh->get_cell_size()) != 0.0) {
+	if (p_navigation_mesh->get_border_size() > 0.0 && !Math::is_zero_approx(Math::fmod(p_navigation_mesh->get_border_size(), p_navigation_mesh->get_cell_size()))) {
 		WARN_PRINT("Property border_size is ceiled to cell_size voxel units and loses precision.");
 	}
 	if (!Math::is_equal_approx((float)cfg.walkableHeight * cfg.ch, p_navigation_mesh->get_agent_height())) {