class_navigation2d.rst 6.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Navigation2D.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Navigation2D:
  5. Navigation2D
  6. ============
  7. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. 2D navigation and pathfinding node.
  12. Methods
  13. -------
  14. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Vector2<class_Vector2>` | :ref:`get_closest_point<class_Navigation2D_method_get_closest_point>` **(** :ref:`Vector2<class_Vector2>` to_point **)** |
  16. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`Object<class_Object>` | :ref:`get_closest_point_owner<class_Navigation2D_method_get_closest_point_owner>` **(** :ref:`Vector2<class_Vector2>` to_point **)** |
  18. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`PoolVector2Array<class_PoolVector2Array>` | :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 **)** |
  20. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`navpoly_add<class_Navigation2D_method_navpoly_add>` **(** :ref:`NavigationPolygon<class_NavigationPolygon>` mesh, :ref:`Transform2D<class_Transform2D>` xform, :ref:`Object<class_Object>` owner=null **)** |
  22. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`navpoly_remove<class_Navigation2D_method_navpoly_remove>` **(** :ref:`int<class_int>` id **)** |
  24. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`navpoly_set_transform<class_Navigation2D_method_navpoly_set_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform2D<class_Transform2D>` xform **)** |
  26. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. Description
  28. -----------
  29. Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of :ref:`NavigationPolygon<class_NavigationPolygon>` resources. By default these are automatically collected from child :ref:`NavigationPolygonInstance<class_NavigationPolygonInstance>` nodes, but they can also be added on the fly with :ref:`navpoly_add<class_Navigation2D_method_navpoly_add>`.
  30. Method Descriptions
  31. -------------------
  32. .. _class_Navigation2D_method_get_closest_point:
  33. - :ref:`Vector2<class_Vector2>` **get_closest_point** **(** :ref:`Vector2<class_Vector2>` to_point **)**
  34. Returns the navigation point closest to the point given. Points are in local coordinate space.
  35. .. _class_Navigation2D_method_get_closest_point_owner:
  36. - :ref:`Object<class_Object>` **get_closest_point_owner** **(** :ref:`Vector2<class_Vector2>` to_point **)**
  37. Returns the owner of the :ref:`NavigationPolygon<class_NavigationPolygon>` which contains the navigation point closest to the point given. This is usually a :ref:`NavigationPolygonInstance<class_NavigationPolygonInstance>`. For polygons added via :ref:`navpoly_add<class_Navigation2D_method_navpoly_add>`, returns the owner that was given (or ``null`` if the ``owner`` parameter was omitted).
  38. .. _class_Navigation2D_method_get_simple_path:
  39. - :ref:`PoolVector2Array<class_PoolVector2Array>` **get_simple_path** **(** :ref:`Vector2<class_Vector2>` start, :ref:`Vector2<class_Vector2>` end, :ref:`bool<class_bool>` optimize=true **)**
  40. 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.
  41. .. _class_Navigation2D_method_navpoly_add:
  42. - :ref:`int<class_int>` **navpoly_add** **(** :ref:`NavigationPolygon<class_NavigationPolygon>` mesh, :ref:`Transform2D<class_Transform2D>` xform, :ref:`Object<class_Object>` owner=null **)**
  43. Adds a :ref:`NavigationPolygon<class_NavigationPolygon>`. Returns an ID for use with :ref:`navpoly_remove<class_Navigation2D_method_navpoly_remove>` or :ref:`navpoly_set_transform<class_Navigation2D_method_navpoly_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_Navigation2D_method_get_closest_point_owner>`.
  44. .. _class_Navigation2D_method_navpoly_remove:
  45. - void **navpoly_remove** **(** :ref:`int<class_int>` id **)**
  46. Removes the :ref:`NavigationPolygon<class_NavigationPolygon>` with the given ID.
  47. .. _class_Navigation2D_method_navpoly_set_transform:
  48. - void **navpoly_set_transform** **(** :ref:`int<class_int>` id, :ref:`Transform2D<class_Transform2D>` xform **)**
  49. Sets the transform applied to the :ref:`NavigationPolygon<class_NavigationPolygon>` with the given ID.