navigation_debug_tools.rst 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. .. _doc_navigation_debug_tools:
  2. Navigation Debug Tools
  3. ======================
  4. .. note::
  5. The debug tools, properties and functions are only available in Godot debug builds.
  6. Do not use any of them in code that will be part of a release build.
  7. Enabling debug navigation
  8. -------------------------
  9. The navigation debug visualization is enabled by default inside the Editor.
  10. To visualize navigation meshes and connections also at runtime
  11. enable the option ``Visible Navigation`` in the editor debug menu.
  12. .. image:: img/navigation_debug_toggle.png
  13. In Godot debug builds the navigation debug can also be toggled on the NavigationServers from scripts.
  14. .. tabs::
  15. .. code-tab:: gdscript GDScript
  16. NavigationServer2D.set_debug_enabled(false)
  17. NavigationServer3D.set_debug_enabled(true)
  18. Debug navigation settings
  19. -------------------------
  20. The appearance of navigation debug can be change in the ProjectSettings under ``debug/shapes/navigation``.
  21. Certain debug features can also be enabled or disabled at will but may require a scene restart to apply.
  22. .. image:: img/nav_debug_settings.png
  23. Debug navigation mesh polygons
  24. ------------------------------
  25. If ``enable_edge_lines`` is enabled the edges of navigation mesh polygons will be highlighted.
  26. If ``enable_edge_lines_xray`` is also enabled the edges of navigationmeshes will be visible through geometry.
  27. if ``enable_geometry_face_random_color`` is enabled each navigation mesh face receives
  28. a random color that is mixed with the main color from ``geometry_face_color``.
  29. .. image:: img/nav_debug_xray_edge_lines.png
  30. Debug edge connections
  31. ----------------------
  32. Different navigation meshes connected within ``edge_connection_margin`` distance are overlaid.
  33. The color of the overlay is controlled with the navigation debug ``edge_connection_color``.
  34. The connections can be made visible through geometry with the navigation debug ``enable_edge_connections_xray`` property.
  35. .. image:: img/nav_edge_connection2d.gif
  36. .. image:: img/nav_edge_connection3d.gif
  37. .. note::
  38. Edge connections are only visible when the NavigationServer is active.
  39. Debug Performance
  40. -----------------
  41. To measure NavigationServer performance a dedicated monitor exists that can be found within the Editor Debugger under `Debugger->Monitors->NavigationProcess`.
  42. .. image:: img/navigation_debug_performance1.webp
  43. NavigationProcess shows how long the NavigationServer spends updating its internals this update frame in milliseconds.
  44. NavigationProcess works similar to Process for visual frame rendering and PhysicsProcess for collision and fixed updates.
  45. NavigationProcess accounts for all updates to ``navigation maps``, ``navigation regions`` and ``navigation agents`` as well as all the ``avoidance calculations`` for the update frame.
  46. .. note::
  47. NavigationProcess does NOT include pathfinding performance cause pathfinding operates on the navigation map data independently from the server process update.
  48. NavigationProcess should be in general kept as low and as stable as possible for runtime performance to avoid frame rate issues.
  49. Note that since the NavigationServer process update happens in the middle of the physics update an increase in NavigationProcess will automatically increase PhysicsProcess by the same amount.
  50. Navigation also provides more detailed statistics about the current navigation related objects and navigation map composition on the NavigationServer.
  51. .. image:: img/navigation_debug_performance2.webp
  52. Navigation statistics shown here can not be judged as good or bad for performance as it depends entirely on the project what can be considered as reasonable or horribly excessive.
  53. Navigation statistics help with identifying performance bottlenecks that are less obvious because the source might not always have a visible representation.
  54. E.g. pathfinding performance issues created by overly detailed navigation meshes with thousand of edges / polygons or problems caused by procedural navigation gone wrong.