summaryrefslogtreecommitdiffstats
path: root/modules/navigation/3d/nav_mesh_generator_3d.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-03-24 01:21:56 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-03-24 01:21:56 +0100
commitc3370023b6ffd29069a91ca8c3c2e4a3cacc2d76 (patch)
tree5b28f59194713eb5e5d5e253c97fcfd63aa1942c /modules/navigation/3d/nav_mesh_generator_3d.cpp
parent77cc2501e170701a3db6baf101227ea20de27248 (diff)
parent64fc9e2156640d03aa078a9483e9c9281aa68c1f (diff)
downloadredot-engine-c3370023b6ffd29069a91ca8c3c2e4a3cacc2d76.tar.gz
Merge pull request #89692 from Scony/baking-crash-prevention
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