summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-05-11 23:17:12 +0200
committerGitHub <noreply@github.com>2022-05-11 23:17:12 +0200
commit516ec892b43a89ac19dfa608b9d754f630a646cc (patch)
tree66f10ac0f096b4615b5b5e5f6df881d263938674
parent9c746b32131d79d85fe05a09db7d8f2f229c3362 (diff)
parent79511af7c94b447409d10194239069facef9c4a0 (diff)
Merge pull request #60945 from smix8/navmesh_bake_size_warning_4.x
Add Warning to NavigationMesh bake when source geometry is suspiciously big
-rw-r--r--modules/navigation/navigation_mesh_generator.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/navigation/navigation_mesh_generator.cpp b/modules/navigation/navigation_mesh_generator.cpp
index 2d6c78f704..110a4f5138 100644
--- a/modules/navigation/navigation_mesh_generator.cpp
+++ b/modules/navigation/navigation_mesh_generator.cpp
@@ -462,6 +462,14 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh(
#endif
rcCalcGridSize(cfg.bmin, cfg.bmax, cfg.cs, &cfg.width, &cfg.height);
+ // ~30000000 seems to be around sweetspot where Editor baking breaks
+ if ((cfg.width * cfg.height) > 30000000) {
+ WARN_PRINT("NavigationMesh baking process will likely fail."
+ "\nSource geometry is suspiciously big for the current Cell Size and Cell Height in the NavMesh Resource bake settings."
+ "\nIf baking does not fail, the resulting NavigationMesh will create serious pathfinding performance issues."
+ "\nIt is advised to increase Cell Size and/or Cell Height in the NavMesh Resource bake settings or reduce the size / scale of the source geometry.");
+ }
+
#ifdef TOOLS_ENABLED
if (ep) {
ep->step(TTR("Creating heightfield..."), 3);