summaryrefslogtreecommitdiffstats
path: root/modules/navigation/3d/nav_mesh_generator_3d.cpp
diff options
context:
space:
mode:
authorPawel Lampe <pawel.lampe@gmail.com>2024-03-18 18:46:12 +0100
committerPawel Lampe <pawel.lampe@gmail.com>2024-03-23 22:20:00 +0100
commit64fc9e2156640d03aa078a9483e9c9281aa68c1f (patch)
tree030eb7bd42db0b1684e4990f6b33f8f7e1fe3430 /modules/navigation/3d/nav_mesh_generator_3d.cpp
parentfe01776f05b1787b28b4a270d53037a3c25f4ca2 (diff)
downloadredot-engine-64fc9e2156640d03aa078a9483e9c9281aa68c1f.tar.gz
Add navigation baking crash prevention mechanism
Diffstat (limited to 'modules/navigation/3d/nav_mesh_generator_3d.cpp')
-rw-r--r--modules/navigation/3d/nav_mesh_generator_3d.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/navigation/3d/nav_mesh_generator_3d.cpp b/modules/navigation/3d/nav_mesh_generator_3d.cpp
index b3391398a6..8b43eba080 100644
--- a/modules/navigation/3d/nav_mesh_generator_3d.cpp
+++ b/modules/navigation/3d/nav_mesh_generator_3d.cpp
@@ -750,11 +750,14 @@ void NavMeshGenerator3D::generator_bake_from_source_geometry_data(Ref<Navigation
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.");
+ if ((cfg.width * cfg.height) > 30000000 && GLOBAL_GET("navigation/baking/use_crash_prevention_checks")) {
+ ERR_FAIL_MSG("Baking interrupted."
+ "\nNavigationMesh baking process would likely crash the engine."
+ "\nSource geometry is suspiciously big for the current Cell Size and Cell Height in the NavMesh Resource bake settings."
+ "\nIf baking does not crash the engine or 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."
+ "\nIf you would like to try baking anyway, disable the 'navigation/baking/use_crash_prevention_checks' project setting.");
+ return;
}
bake_state = "Creating heightfield..."; // step #3