Navigation2D.xml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Navigation2D" inherits="Node2D" version="3.3">
  3. <brief_description>
  4. 2D navigation and pathfinding node.
  5. </brief_description>
  6. <description>
  7. Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of [NavigationPolygon] resources. By default, these are automatically collected from child [NavigationPolygonInstance] nodes, but they can also be added on the fly with [method navpoly_add].
  8. [b]Note:[/b] The current navigation system has many known issues and will not always return optimal paths as expected. These issues will be fixed in Godot 4.0.
  9. </description>
  10. <tutorials>
  11. <link title="2D Navigation Demo">https://godotengine.org/asset-library/asset/117</link>
  12. </tutorials>
  13. <methods>
  14. <method name="get_closest_point">
  15. <return type="Vector2" />
  16. <argument index="0" name="to_point" type="Vector2" />
  17. <description>
  18. Returns the navigation point closest to the point given. Points are in local coordinate space.
  19. </description>
  20. </method>
  21. <method name="get_closest_point_owner">
  22. <return type="Object" />
  23. <argument index="0" name="to_point" type="Vector2" />
  24. <description>
  25. Returns the owner of the [NavigationPolygon] which contains the navigation point closest to the point given. This is usually a [NavigationPolygonInstance]. For polygons added via [method navpoly_add], returns the owner that was given (or [code]null[/code] if the [code]owner[/code] parameter was omitted).
  26. </description>
  27. </method>
  28. <method name="get_simple_path">
  29. <return type="PoolVector2Array" />
  30. <argument index="0" name="start" type="Vector2" />
  31. <argument index="1" name="end" type="Vector2" />
  32. <argument index="2" name="optimize" type="bool" default="true" />
  33. <description>
  34. Returns the path between two given points. Points are in local coordinate space. If [code]optimize[/code] is [code]true[/code] (the default), the path is smoothed by merging path segments where possible.
  35. [b]Note:[/b] This method has known issues and will often return non-optimal paths. These issues will be fixed in Godot 4.0.
  36. </description>
  37. </method>
  38. <method name="navpoly_add">
  39. <return type="int" />
  40. <argument index="0" name="mesh" type="NavigationPolygon" />
  41. <argument index="1" name="xform" type="Transform2D" />
  42. <argument index="2" name="owner" type="Object" default="null" />
  43. <description>
  44. Adds a [NavigationPolygon]. Returns an ID for use with [method navpoly_remove] or [method navpoly_set_transform]. If given, a [Transform2D] is applied to the polygon. The optional [code]owner[/code] is used as return value for [method get_closest_point_owner].
  45. </description>
  46. </method>
  47. <method name="navpoly_remove">
  48. <return type="void" />
  49. <argument index="0" name="id" type="int" />
  50. <description>
  51. Removes the [NavigationPolygon] with the given ID.
  52. </description>
  53. </method>
  54. <method name="navpoly_set_transform">
  55. <return type="void" />
  56. <argument index="0" name="id" type="int" />
  57. <argument index="1" name="xform" type="Transform2D" />
  58. <description>
  59. Sets the transform applied to the [NavigationPolygon] with the given ID.
  60. </description>
  61. </method>
  62. </methods>
  63. <constants>
  64. </constants>
  65. </class>