navigation_using_navigationlinks.rst 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. .. _doc_navigation_using_navigationlinks:
  2. Using NavigationLinks
  3. =====================
  4. .. image:: img/nav_navmesh_links.png
  5. NavigationLinks are used to connect navigation mesh polygons from :ref:`NavigationRegion2D<class_NavigationRegion2D>`
  6. and :ref:`NavigationRegion3D<class_NavigationRegion3D>` over arbitrary distances for pathfinding.
  7. NavigationLinks are also used to consider movement shortcuts in pathfinding available through
  8. interacting with gameplay objects e.g. ladders, jump pads or teleports.
  9. 2D and 3D versions of NavigationJumplinks nodes are available as
  10. :ref:`NavigationLink2D<class_NavigationLink2D>` and
  11. :ref:`NavigationLink3D<class_NavigationLink3D>` respectively.
  12. Different NavigationRegions can connect their navigation meshes without the need for a NavigationLink
  13. as long as they are within navigation map ``edge_connection_margin`` and have compatible ``navigation_layers``.
  14. As soon as the distance becomes too large, building valid connections becomes a problem - a problem that NavigationLinks can solve.
  15. See :ref:`doc_navigation_using_navigationregions` to learn more about the use of navigation regions.
  16. See :ref:`doc_navigation_connecting_navmesh` to learn more about how to connect navigation meshes.
  17. .. image:: img/nav_link_properties.png
  18. NavigationLinks share many properties with NavigationRegions like ``navigation_layers``.
  19. NavigationLinks add a single connection between two positions over an arbitrary distance
  20. compared to NavigationRegions that add a more local traversable area with a navigation mesh resource.
  21. NavigationLinks have a ``start_position`` and ``end_position`` and can go in both directions when ``bidirectional`` is enabled.
  22. When placed a navigationlink connects the navigation mesh polygons closest to its ``start_position`` and ``end_position`` within search radius for pathfinding.
  23. The polygon search radius can be configured globally in the ProjectSettings under ``navigation/2d_or_3d/default_link_connection_radius``
  24. or set for each navigation ``map`` individually using the ``NavigationServer.map_set_link_connection_radius()`` function.
  25. Both ``start_position`` and ``end_position`` have debug markers in the Editor.
  26. The visible radius of a position shows the polygon search radius.
  27. All navigation mesh polygons inside are compared and the closest is picked for the edge connection.
  28. If no valid polygon is found within the search radius the navigation link gets disabled.
  29. .. image:: img/nav_link_debug_visuals.png
  30. The link debug visuals can be changed in the Editor :ref:`ProjectSettings<class_ProjectSettings>` under ``debug/shapes/navigation``.
  31. The visibility of the debug can also be controlled in the Editor 3D Viewport gizmo menu.
  32. .. note::
  33. NavigationLinks do not move agents between the two link positions by themselves.
  34. A navigation link does not provide any automated movement through the link. Instead, when
  35. an agent reaches the position of a link, game code needs to react (e.g. through area triggers) and provide means for the agent
  36. to move through the link to end up at the links other position (e.g. through teleport or animation) to continue along the path.