class_navigation.rst 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 Navigation.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Navigation:
  6. Navigation
  7. ==========
  8. **Inherits:** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Mesh-based navigation and pathfinding node.
  10. Description
  11. -----------
  12. Provides navigation and pathfinding within a collection of :ref:`NavigationMesh<class_NavigationMesh>`\ es. These will be automatically collected from child :ref:`NavigationRegion<class_NavigationRegion>` nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
  13. Properties
  14. ----------
  15. +-------------------------------+---------------------------------------------------------------------------------+------------------------+
  16. | :ref:`float<class_float>` | :ref:`cell_size<class_Navigation_property_cell_size>` | ``0.3`` |
  17. +-------------------------------+---------------------------------------------------------------------------------+------------------------+
  18. | :ref:`float<class_float>` | :ref:`edge_connection_margin<class_Navigation_property_edge_connection_margin>` | ``5.0`` |
  19. +-------------------------------+---------------------------------------------------------------------------------+------------------------+
  20. | :ref:`Vector3<class_Vector3>` | :ref:`up_vector<class_Navigation_property_up_vector>` | ``Vector3( 0, 1, 0 )`` |
  21. +-------------------------------+---------------------------------------------------------------------------------+------------------------+
  22. Methods
  23. -------
  24. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Vector3<class_Vector3>` | :ref:`get_closest_point<class_Navigation_method_get_closest_point>` **(** :ref:`Vector3<class_Vector3>` to_point **)** const |
  26. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Vector3<class_Vector3>` | :ref:`get_closest_point_normal<class_Navigation_method_get_closest_point_normal>` **(** :ref:`Vector3<class_Vector3>` to_point **)** const |
  28. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`RID<class_RID>` | :ref:`get_closest_point_owner<class_Navigation_method_get_closest_point_owner>` **(** :ref:`Vector3<class_Vector3>` to_point **)** const |
  30. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Vector3<class_Vector3>` | :ref:`get_closest_point_to_segment<class_Navigation_method_get_closest_point_to_segment>` **(** :ref:`Vector3<class_Vector3>` start, :ref:`Vector3<class_Vector3>` end, :ref:`bool<class_bool>` use_collision=false **)** const |
  32. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`RID<class_RID>` | :ref:`get_rid<class_Navigation_method_get_rid>` **(** **)** const |
  34. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`get_simple_path<class_Navigation_method_get_simple_path>` **(** :ref:`Vector3<class_Vector3>` start, :ref:`Vector3<class_Vector3>` end, :ref:`bool<class_bool>` optimize=true **)** const |
  36. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. Property Descriptions
  38. ---------------------
  39. .. _class_Navigation_property_cell_size:
  40. - :ref:`float<class_float>` **cell_size**
  41. +-----------+----------------------+
  42. | *Default* | ``0.3`` |
  43. +-----------+----------------------+
  44. | *Setter* | set_cell_size(value) |
  45. +-----------+----------------------+
  46. | *Getter* | get_cell_size() |
  47. +-----------+----------------------+
  48. ----
  49. .. _class_Navigation_property_edge_connection_margin:
  50. - :ref:`float<class_float>` **edge_connection_margin**
  51. +-----------+-----------------------------------+
  52. | *Default* | ``5.0`` |
  53. +-----------+-----------------------------------+
  54. | *Setter* | set_edge_connection_margin(value) |
  55. +-----------+-----------------------------------+
  56. | *Getter* | get_edge_connection_margin() |
  57. +-----------+-----------------------------------+
  58. ----
  59. .. _class_Navigation_property_up_vector:
  60. - :ref:`Vector3<class_Vector3>` **up_vector**
  61. +-----------+------------------------+
  62. | *Default* | ``Vector3( 0, 1, 0 )`` |
  63. +-----------+------------------------+
  64. | *Setter* | set_up_vector(value) |
  65. +-----------+------------------------+
  66. | *Getter* | get_up_vector() |
  67. +-----------+------------------------+
  68. Defines which direction is up. By default, this is ``(0, 1, 0)``, which is the world's "up" direction.
  69. Method Descriptions
  70. -------------------
  71. .. _class_Navigation_method_get_closest_point:
  72. - :ref:`Vector3<class_Vector3>` **get_closest_point** **(** :ref:`Vector3<class_Vector3>` to_point **)** const
  73. Returns the point closest to the provided ``to_point`` on the navigation mesh surface.
  74. ----
  75. .. _class_Navigation_method_get_closest_point_normal:
  76. - :ref:`Vector3<class_Vector3>` **get_closest_point_normal** **(** :ref:`Vector3<class_Vector3>` to_point **)** const
  77. Returns the normal for the point returned by :ref:`get_closest_point<class_Navigation_method_get_closest_point>`.
  78. ----
  79. .. _class_Navigation_method_get_closest_point_owner:
  80. - :ref:`RID<class_RID>` **get_closest_point_owner** **(** :ref:`Vector3<class_Vector3>` to_point **)** const
  81. Returns the owner region RID for the point returned by :ref:`get_closest_point<class_Navigation_method_get_closest_point>`.
  82. ----
  83. .. _class_Navigation_method_get_closest_point_to_segment:
  84. - :ref:`Vector3<class_Vector3>` **get_closest_point_to_segment** **(** :ref:`Vector3<class_Vector3>` start, :ref:`Vector3<class_Vector3>` end, :ref:`bool<class_bool>` use_collision=false **)** const
  85. Returns the closest point between the navigation surface and the segment.
  86. ----
  87. .. _class_Navigation_method_get_rid:
  88. - :ref:`RID<class_RID>` **get_rid** **(** **)** const
  89. ----
  90. .. _class_Navigation_method_get_simple_path:
  91. - :ref:`PackedVector3Array<class_PackedVector3Array>` **get_simple_path** **(** :ref:`Vector3<class_Vector3>` start, :ref:`Vector3<class_Vector3>` end, :ref:`bool<class_bool>` optimize=true **)** const
  92. Returns the path between two given points. Points are in local coordinate space. If ``optimize`` is ``true`` (the default), the agent properties associated with each :ref:`NavigationMesh<class_NavigationMesh>` (radius, height, etc.) are considered in the path calculation, otherwise they are ignored.