class_navigation2d.rst 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. Member Functions
  13. ----------------
  14. +--------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Vector2<class_vector2>` | :ref:`get_closest_point<class_Navigation2D_get_closest_point>` **(** :ref:`Vector2<class_vector2>` to_point **)** |
  16. +--------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`Object<class_object>` | :ref:`get_closest_point_owner<class_Navigation2D_get_closest_point_owner>` **(** :ref:`Vector2<class_vector2>` to_point **)** |
  18. +--------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`PoolVector2Array<class_poolvector2array>` | :ref:`get_simple_path<class_Navigation2D_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_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_navpoly_remove>` **(** :ref:`int<class_int>` id **)** |
  24. +--------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`navpoly_set_transform<class_Navigation2D_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_navpoly_add>`.
  30. Member Function Description
  31. ---------------------------
  32. .. _class_Navigation2D_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_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 NavigtionPolygonInstance. For polygons added via :ref:`navpoly_add<class_Navigation2D_navpoly_add>`, returns the owner that was given (or ``null`` if the ``owner`` parameter was omitted).
  38. .. _class_Navigation2D_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_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_navpoly_remove>` or :ref:`navpoly_set_transform<class_Navigation2D_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_get_closest_point_owner>`.
  44. .. _class_Navigation2D_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_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.