Navigation2D.xml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Navigation2D" inherits="Node2D" version="3.2">
  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. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="get_closest_point">
  13. <return type="Vector2">
  14. </return>
  15. <argument index="0" name="to_point" type="Vector2">
  16. </argument>
  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. </return>
  24. <argument index="0" name="to_point" type="Vector2">
  25. </argument>
  26. <description>
  27. 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).
  28. </description>
  29. </method>
  30. <method name="get_simple_path">
  31. <return type="PoolVector2Array">
  32. </return>
  33. <argument index="0" name="start" type="Vector2">
  34. </argument>
  35. <argument index="1" name="end" type="Vector2">
  36. </argument>
  37. <argument index="2" name="optimize" type="bool" default="true">
  38. </argument>
  39. <description>
  40. 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.
  41. </description>
  42. </method>
  43. <method name="navpoly_add">
  44. <return type="int">
  45. </return>
  46. <argument index="0" name="mesh" type="NavigationPolygon">
  47. </argument>
  48. <argument index="1" name="xform" type="Transform2D">
  49. </argument>
  50. <argument index="2" name="owner" type="Object" default="null">
  51. </argument>
  52. <description>
  53. 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].
  54. </description>
  55. </method>
  56. <method name="navpoly_remove">
  57. <return type="void">
  58. </return>
  59. <argument index="0" name="id" type="int">
  60. </argument>
  61. <description>
  62. Removes the [NavigationPolygon] with the given ID.
  63. </description>
  64. </method>
  65. <method name="navpoly_set_transform">
  66. <return type="void">
  67. </return>
  68. <argument index="0" name="id" type="int">
  69. </argument>
  70. <argument index="1" name="xform" type="Transform2D">
  71. </argument>
  72. <description>
  73. Sets the transform applied to the [NavigationPolygon] with the given ID.
  74. </description>
  75. </method>
  76. </methods>
  77. <constants>
  78. </constants>
  79. </class>