class_navigation2d.rst 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Navigation2D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Navigation2D:
  6. Navigation2D
  7. ============
  8. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. 2D navigation and pathfinding node.
  10. Description
  11. -----------
  12. Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of :ref:`NavigationPolygon<class_NavigationPolygon>` resources. These are automatically collected from child :ref:`NavigationRegion2D<class_NavigationRegion2D>` nodes.
  13. Properties
  14. ----------
  15. +---------------------------+-----------------------------------------------------------------------------------+-----------+
  16. | :ref:`float<class_float>` | :ref:`cell_size<class_Navigation2D_property_cell_size>` | ``10.0`` |
  17. +---------------------------+-----------------------------------------------------------------------------------+-----------+
  18. | :ref:`float<class_float>` | :ref:`edge_connection_margin<class_Navigation2D_property_edge_connection_margin>` | ``100.0`` |
  19. +---------------------------+-----------------------------------------------------------------------------------+-----------+
  20. Methods
  21. -------
  22. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Vector2<class_Vector2>` | :ref:`get_closest_point<class_Navigation2D_method_get_closest_point>` **(** :ref:`Vector2<class_Vector2>` to_point **)** const |
  24. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`RID<class_RID>` | :ref:`get_closest_point_owner<class_Navigation2D_method_get_closest_point_owner>` **(** :ref:`Vector2<class_Vector2>` to_point **)** const |
  26. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`RID<class_RID>` | :ref:`get_rid<class_Navigation2D_method_get_rid>` **(** **)** const |
  28. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_simple_path<class_Navigation2D_method_get_simple_path>` **(** :ref:`Vector2<class_Vector2>` start, :ref:`Vector2<class_Vector2>` end, :ref:`bool<class_bool>` optimize=true **)** const |
  30. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. Property Descriptions
  32. ---------------------
  33. .. _class_Navigation2D_property_cell_size:
  34. - :ref:`float<class_float>` **cell_size**
  35. +-----------+----------------------+
  36. | *Default* | ``10.0`` |
  37. +-----------+----------------------+
  38. | *Setter* | set_cell_size(value) |
  39. +-----------+----------------------+
  40. | *Getter* | get_cell_size() |
  41. +-----------+----------------------+
  42. ----
  43. .. _class_Navigation2D_property_edge_connection_margin:
  44. - :ref:`float<class_float>` **edge_connection_margin**
  45. +-----------+-----------------------------------+
  46. | *Default* | ``100.0`` |
  47. +-----------+-----------------------------------+
  48. | *Setter* | set_edge_connection_margin(value) |
  49. +-----------+-----------------------------------+
  50. | *Getter* | get_edge_connection_margin() |
  51. +-----------+-----------------------------------+
  52. Method Descriptions
  53. -------------------
  54. .. _class_Navigation2D_method_get_closest_point:
  55. - :ref:`Vector2<class_Vector2>` **get_closest_point** **(** :ref:`Vector2<class_Vector2>` to_point **)** const
  56. Returns the point closest to the provided ``to_point`` on the navigation mesh surface.
  57. ----
  58. .. _class_Navigation2D_method_get_closest_point_owner:
  59. - :ref:`RID<class_RID>` **get_closest_point_owner** **(** :ref:`Vector2<class_Vector2>` to_point **)** const
  60. Returns the owner region RID for the point returned by :ref:`get_closest_point<class_Navigation2D_method_get_closest_point>`.
  61. ----
  62. .. _class_Navigation2D_method_get_rid:
  63. - :ref:`RID<class_RID>` **get_rid** **(** **)** const
  64. ----
  65. .. _class_Navigation2D_method_get_simple_path:
  66. - :ref:`PackedVector2Array<class_PackedVector2Array>` **get_simple_path** **(** :ref:`Vector2<class_Vector2>` start, :ref:`Vector2<class_Vector2>` end, :ref:`bool<class_bool>` optimize=true **)** const
  67. Returns the path between two given points. Points are in local coordinate space. If ``optimize`` is ``true`` (the default), the path is smoothed by merging path segments where possible.