class_navigation.rst 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Navigation.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Navigation:
  5. Navigation
  6. ==========
  7. **Inherits:** :ref:`Spatial<class_spatial>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Mesh-based navigation and pathfinding node.
  12. Member Functions
  13. ----------------
  14. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Vector3<class_vector3>` | :ref:`get_closest_point<class_Navigation_get_closest_point>` **(** :ref:`Vector3<class_vector3>` to_point **)** |
  16. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`Vector3<class_vector3>` | :ref:`get_closest_point_normal<class_Navigation_get_closest_point_normal>` **(** :ref:`Vector3<class_vector3>` to_point **)** |
  18. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`Object<class_object>` | :ref:`get_closest_point_owner<class_Navigation_get_closest_point_owner>` **(** :ref:`Vector3<class_vector3>` to_point **)** |
  20. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`Vector3<class_vector3>` | :ref:`get_closest_point_to_segment<class_Navigation_get_closest_point_to_segment>` **(** :ref:`Vector3<class_vector3>` start, :ref:`Vector3<class_vector3>` end, :ref:`bool<class_bool>` use_collision=false **)** |
  22. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`PoolVector3Array<class_poolvector3array>` | :ref:`get_simple_path<class_Navigation_get_simple_path>` **(** :ref:`Vector3<class_vector3>` start, :ref:`Vector3<class_vector3>` end, :ref:`bool<class_bool>` optimize=true **)** |
  24. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`int<class_int>` | :ref:`navmesh_add<class_Navigation_navmesh_add>` **(** :ref:`NavigationMesh<class_navigationmesh>` mesh, :ref:`Transform<class_transform>` xform, :ref:`Object<class_object>` owner=null **)** |
  26. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`navmesh_remove<class_Navigation_navmesh_remove>` **(** :ref:`int<class_int>` id **)** |
  28. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`navmesh_set_transform<class_Navigation_navmesh_set_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform<class_transform>` xform **)** |
  30. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. Member Variables
  32. ----------------
  33. .. _class_Navigation_up_vector:
  34. - :ref:`Vector3<class_vector3>` **up_vector** - Defines which direction is up. By default this is ``(0, 1, 0)``, which is the world up direction.
  35. Description
  36. -----------
  37. Provides navigation and pathfinding within a collection of :ref:`NavigationMesh<class_navigationmesh>`\ es. By default these will be automatically collected from child :ref:`NavigationMeshInstance<class_navigationmeshinstance>` nodes, but they can also be added on the fly with :ref:`navmesh_add<class_Navigation_navmesh_add>`. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
  38. Member Function Description
  39. ---------------------------
  40. .. _class_Navigation_get_closest_point:
  41. - :ref:`Vector3<class_vector3>` **get_closest_point** **(** :ref:`Vector3<class_vector3>` to_point **)**
  42. Returns the navigation point closest to the point given. Points are in local coordinate space.
  43. .. _class_Navigation_get_closest_point_normal:
  44. - :ref:`Vector3<class_vector3>` **get_closest_point_normal** **(** :ref:`Vector3<class_vector3>` to_point **)**
  45. Returns the surface normal at the navigation point closest to the point given. Useful for rotating a navigation agent according to the navigation mesh it moves on.
  46. .. _class_Navigation_get_closest_point_owner:
  47. - :ref:`Object<class_object>` **get_closest_point_owner** **(** :ref:`Vector3<class_vector3>` to_point **)**
  48. Returns the owner of the :ref:`NavigationMesh<class_navigationmesh>` which contains the navigation point closest to the point given. This is usually a NavigtionMeshInstance. For meshes added via :ref:`navmesh_add<class_Navigation_navmesh_add>`, returns the owner that was given (or ``null`` if the ``owner`` parameter was omitted).
  49. .. _class_Navigation_get_closest_point_to_segment:
  50. - :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 **)**
  51. Returns the navigation point closest to the given line segment. When enabling ``use_collision``, only considers intersection points between segment and navigation meshes. If multiple intersection points are found, the one closest to the segment start point is returned.
  52. .. _class_Navigation_get_simple_path:
  53. - :ref:`PoolVector3Array<class_poolvector3array>` **get_simple_path** **(** :ref:`Vector3<class_vector3>` start, :ref:`Vector3<class_vector3>` end, :ref:`bool<class_bool>` optimize=true **)**
  54. 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>` (raidus, height, etc.) are considered in the path calculation, otherwise they are ignored.
  55. .. _class_Navigation_navmesh_add:
  56. - :ref:`int<class_int>` **navmesh_add** **(** :ref:`NavigationMesh<class_navigationmesh>` mesh, :ref:`Transform<class_transform>` xform, :ref:`Object<class_object>` owner=null **)**
  57. Adds a :ref:`NavigationMesh<class_navigationmesh>`. Returns an ID for use with :ref:`navmesh_remove<class_Navigation_navmesh_remove>` or :ref:`navmesh_set_transform<class_Navigation_navmesh_set_transform>`. If given, a :ref:`Transform2D<class_transform2d>` is applied to the polygon. The optional ``owner`` is used as return value for :ref:`get_closest_point_owner<class_Navigation_get_closest_point_owner>`.
  58. .. _class_Navigation_navmesh_remove:
  59. - void **navmesh_remove** **(** :ref:`int<class_int>` id **)**
  60. Removes the :ref:`NavigationMesh<class_navigationmesh>` with the given ID.
  61. .. _class_Navigation_navmesh_set_transform:
  62. - void **navmesh_set_transform** **(** :ref:`int<class_int>` id, :ref:`Transform<class_transform>` xform **)**
  63. Sets the transform applied to the :ref:`NavigationMesh<class_navigationmesh>` with the given ID.