Skip to content

Commit

Permalink
Merge pull request #60945 from smix8/navmesh_bake_size_warning_4.x
Browse files Browse the repository at this point in the history
Add Warning to NavigationMesh bake when source geometry is suspiciously big
  • Loading branch information
akien-mga authored May 11, 2022
2 parents 9c746b3 + 79511af commit 516ec89
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/navigation/navigation_mesh_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 516ec89

Please sign in to comment.