class_navigation.rst 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. A collection of ``NavigationMesh`` resources and methods used for pathfinding.
  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. The default defines 0,1,0 as up which is the world up direction. To make this a ceiling use 0,-1,0 to define down as up.
  35. Description
  36. -----------
  37. The Navigation node is used for basic or advanced navigation. By default it will automatically collect all child ``NavigationMesh`` resources, but they can also be added on the fly through scripting. It can be used for generating a simple path between two points or it can be used to ensure that a navigation agent is angled perfectly to the terrain it is navigating.
  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 closest navigation point to the point passed.
  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 of the navigation mesh at the point passed. For instance, if the point passed was at a 45 degree slope it would return something like (0.5,0.5,0). This is useful for rotating a navigation agent in accordance with the ``NavigationMesh``.
  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 nearest ``NavigationMeshInstance`` to the point passed.
  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 nearest point to the line segment passed. The third optional parameter takes collisions into account.
  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 a path of points as a ``PoolVector3Array``. If ``optimize`` is false the ``NavigationMesh`` agent properties will be taken into account, otherwise it will return the nearest path and ignore agent radius, height, etc.
  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 ``NavigationMesh`` to the list of NavigationMesh's in this node. Returns an id. Its position, rotation and scale are associated with the ``Transform`` passed. The ``Node`` (or ``Object``) that owns this node is an optional parameter.
  58. .. _class_Navigation_navmesh_remove:
  59. - void **navmesh_remove** **(** :ref:`int<class_int>` id **)**
  60. Removes a ``NavigationMesh`` from the list of NavigationMesh's in this node.
  61. .. _class_Navigation_navmesh_set_transform:
  62. - void **navmesh_set_transform** **(** :ref:`int<class_int>` id, :ref:`Transform<class_transform>` xform **)**
  63. Associates a ``NavigationMesh``'s id with a ``Transform``. Its position, rotation and scale are based on the ``Transform`` passed.