Navigation.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Navigation" inherits="Spatial" version="3.4">
  3. <brief_description>
  4. Mesh-based navigation and pathfinding node.
  5. </brief_description>
  6. <description>
  7. Provides navigation and pathfinding within a collection of [NavigationMesh]es. By default, these will be automatically collected from child [NavigationMeshInstance] nodes, but they can also be added on the fly with [method navmesh_add]. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
  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="3D Navmesh Demo">https://godotengine.org/asset-library/asset/124</link>
  12. </tutorials>
  13. <methods>
  14. <method name="get_closest_point">
  15. <return type="Vector3">
  16. </return>
  17. <argument index="0" name="to_point" type="Vector3">
  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_normal">
  24. <return type="Vector3">
  25. </return>
  26. <argument index="0" name="to_point" type="Vector3">
  27. </argument>
  28. <description>
  29. Returns the surface normal at the navigation point closest to the point given. Useful for rotating a navigation agent according to the navigation mesh it moves on.
  30. </description>
  31. </method>
  32. <method name="get_closest_point_owner">
  33. <return type="Object">
  34. </return>
  35. <argument index="0" name="to_point" type="Vector3">
  36. </argument>
  37. <description>
  38. Returns the owner of the [NavigationMesh] which contains the navigation point closest to the point given. This is usually a [NavigationMeshInstance]. For meshes added via [method navmesh_add], returns the owner that was given (or [code]null[/code] if the [code]owner[/code] parameter was omitted).
  39. </description>
  40. </method>
  41. <method name="get_closest_point_to_segment">
  42. <return type="Vector3">
  43. </return>
  44. <argument index="0" name="start" type="Vector3">
  45. </argument>
  46. <argument index="1" name="end" type="Vector3">
  47. </argument>
  48. <argument index="2" name="use_collision" type="bool" default="false">
  49. </argument>
  50. <description>
  51. Returns the navigation point closest to the given line segment. When enabling [code]use_collision[/code], only considers intersection points between segment and navigation meshes. If multiple intersection points are found, the one closest to the segment start point is returned.
  52. </description>
  53. </method>
  54. <method name="get_simple_path">
  55. <return type="PoolVector3Array">
  56. </return>
  57. <argument index="0" name="start" type="Vector3">
  58. </argument>
  59. <argument index="1" name="end" type="Vector3">
  60. </argument>
  61. <argument index="2" name="optimize" type="bool" default="true">
  62. </argument>
  63. <description>
  64. Returns the path between two given points. Points are in local coordinate space. If [code]optimize[/code] is [code]true[/code] (the default), the agent properties associated with each [NavigationMesh] (radius, height, etc.) are considered in the path calculation, otherwise they are ignored.
  65. [b]Note:[/b] This method has known issues and will often return non-optimal paths. These issues will be fixed in Godot 4.0.
  66. </description>
  67. </method>
  68. <method name="navmesh_add">
  69. <return type="int">
  70. </return>
  71. <argument index="0" name="mesh" type="NavigationMesh">
  72. </argument>
  73. <argument index="1" name="xform" type="Transform">
  74. </argument>
  75. <argument index="2" name="owner" type="Object" default="null">
  76. </argument>
  77. <description>
  78. Adds a [NavigationMesh]. Returns an ID for use with [method navmesh_remove] or [method navmesh_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].
  79. </description>
  80. </method>
  81. <method name="navmesh_remove">
  82. <return type="void">
  83. </return>
  84. <argument index="0" name="id" type="int">
  85. </argument>
  86. <description>
  87. Removes the [NavigationMesh] with the given ID.
  88. </description>
  89. </method>
  90. <method name="navmesh_set_transform">
  91. <return type="void">
  92. </return>
  93. <argument index="0" name="id" type="int">
  94. </argument>
  95. <argument index="1" name="xform" type="Transform">
  96. </argument>
  97. <description>
  98. Sets the transform applied to the [NavigationMesh] with the given ID.
  99. </description>
  100. </method>
  101. </methods>
  102. <members>
  103. <member name="up_vector" type="Vector3" setter="set_up_vector" getter="get_up_vector" default="Vector3( 0, 1, 0 )">
  104. Defines which direction is up. By default, this is [code](0, 1, 0)[/code], which is the world's "up" direction.
  105. </member>
  106. </members>
  107. <constants>
  108. </constants>
  109. </class>