Navigation2D.xml 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Navigation2D" inherits="Node2D" category="Core" version="3.1">
  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. <demos>
  12. </demos>
  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 [NavigtionPolygonInstance]. 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. </description>
  44. </method>
  45. <method name="navpoly_add">
  46. <return type="int">
  47. </return>
  48. <argument index="0" name="mesh" type="NavigationPolygon">
  49. </argument>
  50. <argument index="1" name="xform" type="Transform2D">
  51. </argument>
  52. <argument index="2" name="owner" type="Object" default="null">
  53. </argument>
  54. <description>
  55. 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].
  56. </description>
  57. </method>
  58. <method name="navpoly_remove">
  59. <return type="void">
  60. </return>
  61. <argument index="0" name="id" type="int">
  62. </argument>
  63. <description>
  64. Removes the [NavigationPolygon] with the given ID.
  65. </description>
  66. </method>
  67. <method name="navpoly_set_transform">
  68. <return type="void">
  69. </return>
  70. <argument index="0" name="id" type="int">
  71. </argument>
  72. <argument index="1" name="xform" type="Transform2D">
  73. </argument>
  74. <description>
  75. Sets the transform applied to the [NavigationPolygon] with the given ID.
  76. </description>
  77. </method>
  78. </methods>
  79. <constants>
  80. </constants>
  81. </class>