Files
godot-docs/classes/class_navigation.rst
2018-05-09 11:13:17 +02:00

105 lines
8.7 KiB
ReStructuredText

.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the Navigation.xml source instead.
.. The source is found in doc/classes or modules/<name>/doc_classes.
.. _class_Navigation:
Navigation
==========
**Inherits:** :ref:`Spatial<class_spatial>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
**Category:** Core
Brief Description
-----------------
Mesh-based navigation and pathfinding node.
Member Functions
----------------
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_vector3>` | :ref:`get_closest_point<class_Navigation_get_closest_point>` **(** :ref:`Vector3<class_vector3>` to_point **)** |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_vector3>` | :ref:`get_closest_point_normal<class_Navigation_get_closest_point_normal>` **(** :ref:`Vector3<class_vector3>` to_point **)** |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Object<class_object>` | :ref:`get_closest_point_owner<class_Navigation_get_closest_point_owner>` **(** :ref:`Vector3<class_vector3>` to_point **)** |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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 **)** |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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 **)** |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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 **)** |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`navmesh_remove<class_Navigation_navmesh_remove>` **(** :ref:`int<class_int>` id **)** |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`navmesh_set_transform<class_Navigation_navmesh_set_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform<class_transform>` xform **)** |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Member Variables
----------------
.. _class_Navigation_up_vector:
- :ref:`Vector3<class_vector3>` **up_vector** - Defines which direction is up. By default this is ``(0, 1, 0)``, which is the world up direction.
Description
-----------
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.
Member Function Description
---------------------------
.. _class_Navigation_get_closest_point:
- :ref:`Vector3<class_vector3>` **get_closest_point** **(** :ref:`Vector3<class_vector3>` to_point **)**
Returns the navigation point closest to the point given. Points are in local coordinate space.
.. _class_Navigation_get_closest_point_normal:
- :ref:`Vector3<class_vector3>` **get_closest_point_normal** **(** :ref:`Vector3<class_vector3>` to_point **)**
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.
.. _class_Navigation_get_closest_point_owner:
- :ref:`Object<class_object>` **get_closest_point_owner** **(** :ref:`Vector3<class_vector3>` to_point **)**
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).
.. _class_Navigation_get_closest_point_to_segment:
- :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 **)**
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.
.. _class_Navigation_get_simple_path:
- :ref:`PoolVector3Array<class_poolvector3array>` **get_simple_path** **(** :ref:`Vector3<class_vector3>` start, :ref:`Vector3<class_vector3>` end, :ref:`bool<class_bool>` optimize=true **)**
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.
.. _class_Navigation_navmesh_add:
- :ref:`int<class_int>` **navmesh_add** **(** :ref:`NavigationMesh<class_navigationmesh>` mesh, :ref:`Transform<class_transform>` xform, :ref:`Object<class_object>` owner=null **)**
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>`.
.. _class_Navigation_navmesh_remove:
- void **navmesh_remove** **(** :ref:`int<class_int>` id **)**
Removes the :ref:`NavigationMesh<class_navigationmesh>` with the given ID.
.. _class_Navigation_navmesh_set_transform:
- void **navmesh_set_transform** **(** :ref:`int<class_int>` id, :ref:`Transform<class_transform>` xform **)**
Sets the transform applied to the :ref:`NavigationMesh<class_navigationmesh>` with the given ID.