Navigation2D.xml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Navigation2D" inherits="Node2D" version="3.4">
  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. </return>
  17. <argument index="0" name="to_point" type="Vector2">
  18. </argument>
  19. <description>
  20. Returns the navigation point closest to the point given. Points are in local coordinate space.
  21. </description>
  22. </method>
  23. <method name="get_closest_point_owner">
  24. <return type="Object">
  25. </return>
  26. <argument index="0" name="to_point" type="Vector2">
  27. </argument>
  28. <description>
  29. 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).
  30. </description>
  31. </method>
  32. <method name="get_simple_path">
  33. <return type="PoolVector2Array">
  34. </return>
  35. <argument index="0" name="start" type="Vector2">
  36. </argument>
  37. <argument index="1" name="end" type="Vector2">
  38. </argument>
  39. <argument index="2" name="optimize" type="bool" default="true">
  40. </argument>
  41. <description>
  42. 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.
  43. [b]Note:[/b] This method has known issues and will often return non-optimal paths. These issues will be fixed in Godot 4.0.
  44. </description>
  45. </method>
  46. <method name="navpoly_add">
  47. <return type="int">
  48. </return>
  49. <argument index="0" name="mesh" type="NavigationPolygon">
  50. </argument>
  51. <argument index="1" name="xform" type="Transform2D">
  52. </argument>
  53. <argument index="2" name="owner" type="Object" default="null">
  54. </argument>
  55. <description>
  56. 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].
  57. </description>
  58. </method>
  59. <method name="navpoly_remove">
  60. <return type="void">
  61. </return>
  62. <argument index="0" name="id" type="int">
  63. </argument>
  64. <description>
  65. Removes the [NavigationPolygon] with the given ID.
  66. </description>
  67. </method>
  68. <method name="navpoly_set_transform">
  69. <return type="void">
  70. </return>
  71. <argument index="0" name="id" type="int">
  72. </argument>
  73. <argument index="1" name="xform" type="Transform2D">
  74. </argument>
  75. <description>
  76. Sets the transform applied to the [NavigationPolygon] with the given ID.
  77. </description>
  78. </method>
  79. </methods>
  80. <constants>
  81. </constants>
  82. </class>