AABB.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="AABB" version="3.4">
  3. <brief_description>
  4. Axis-Aligned Bounding Box.
  5. </brief_description>
  6. <description>
  7. [AABB] consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.
  8. It uses floating-point coordinates. The 2D counterpart to [AABB] is [Rect2].
  9. [b]Note:[/b] Unlike [Rect2], [AABB] does not have a variant that uses integer coordinates.
  10. </description>
  11. <tutorials>
  12. <link title="Math tutorial index">https://docs.godotengine.org/en/3.3/tutorials/math/index.html</link>
  13. <link title="Vector math">https://docs.godotengine.org/en/3.3/tutorials/math/vector_math.html</link>
  14. <link title="Advanced vector math">https://docs.godotengine.org/en/3.3/tutorials/math/vectors_advanced.html</link>
  15. </tutorials>
  16. <methods>
  17. <method name="AABB">
  18. <return type="AABB">
  19. </return>
  20. <argument index="0" name="position" type="Vector3">
  21. </argument>
  22. <argument index="1" name="size" type="Vector3">
  23. </argument>
  24. <description>
  25. Constructs an [AABB] from a position and size.
  26. </description>
  27. </method>
  28. <method name="abs">
  29. <return type="AABB">
  30. </return>
  31. <description>
  32. Returns an AABB with equivalent position and size, modified so that the most-negative corner is the origin and the size is positive.
  33. </description>
  34. </method>
  35. <method name="encloses">
  36. <return type="bool">
  37. </return>
  38. <argument index="0" name="with" type="AABB">
  39. </argument>
  40. <description>
  41. Returns [code]true[/code] if this [AABB] completely encloses another one.
  42. </description>
  43. </method>
  44. <method name="expand">
  45. <return type="AABB">
  46. </return>
  47. <argument index="0" name="to_point" type="Vector3">
  48. </argument>
  49. <description>
  50. Returns this [AABB] expanded to include a given point.
  51. </description>
  52. </method>
  53. <method name="get_area">
  54. <return type="float">
  55. </return>
  56. <description>
  57. Returns the volume of the [AABB].
  58. </description>
  59. </method>
  60. <method name="get_endpoint">
  61. <return type="Vector3">
  62. </return>
  63. <argument index="0" name="idx" type="int">
  64. </argument>
  65. <description>
  66. Gets the position of the 8 endpoints of the [AABB] in space.
  67. </description>
  68. </method>
  69. <method name="get_longest_axis">
  70. <return type="Vector3">
  71. </return>
  72. <description>
  73. Returns the normalized longest axis of the [AABB].
  74. </description>
  75. </method>
  76. <method name="get_longest_axis_index">
  77. <return type="int">
  78. </return>
  79. <description>
  80. Returns the index of the longest axis of the [AABB] (according to [Vector3]'s [code]AXIS_*[/code] constants).
  81. </description>
  82. </method>
  83. <method name="get_longest_axis_size">
  84. <return type="float">
  85. </return>
  86. <description>
  87. Returns the scalar length of the longest axis of the [AABB].
  88. </description>
  89. </method>
  90. <method name="get_shortest_axis">
  91. <return type="Vector3">
  92. </return>
  93. <description>
  94. Returns the normalized shortest axis of the [AABB].
  95. </description>
  96. </method>
  97. <method name="get_shortest_axis_index">
  98. <return type="int">
  99. </return>
  100. <description>
  101. Returns the index of the shortest axis of the [AABB] (according to [Vector3]::AXIS* enum).
  102. </description>
  103. </method>
  104. <method name="get_shortest_axis_size">
  105. <return type="float">
  106. </return>
  107. <description>
  108. Returns the scalar length of the shortest axis of the [AABB].
  109. </description>
  110. </method>
  111. <method name="get_support">
  112. <return type="Vector3">
  113. </return>
  114. <argument index="0" name="dir" type="Vector3">
  115. </argument>
  116. <description>
  117. Returns the support point in a given direction. This is useful for collision detection algorithms.
  118. </description>
  119. </method>
  120. <method name="grow">
  121. <return type="AABB">
  122. </return>
  123. <argument index="0" name="by" type="float">
  124. </argument>
  125. <description>
  126. Returns a copy of the [AABB] grown a given amount of units towards all the sides.
  127. </description>
  128. </method>
  129. <method name="has_no_area">
  130. <return type="bool">
  131. </return>
  132. <description>
  133. Returns [code]true[/code] if the [AABB] is flat or empty.
  134. </description>
  135. </method>
  136. <method name="has_no_surface">
  137. <return type="bool">
  138. </return>
  139. <description>
  140. Returns [code]true[/code] if the [AABB] is empty.
  141. </description>
  142. </method>
  143. <method name="has_point">
  144. <return type="bool">
  145. </return>
  146. <argument index="0" name="point" type="Vector3">
  147. </argument>
  148. <description>
  149. Returns [code]true[/code] if the [AABB] contains a point.
  150. </description>
  151. </method>
  152. <method name="intersection">
  153. <return type="AABB">
  154. </return>
  155. <argument index="0" name="with" type="AABB">
  156. </argument>
  157. <description>
  158. Returns the intersection between two [AABB]. An empty AABB (size 0,0,0) is returned on failure.
  159. </description>
  160. </method>
  161. <method name="intersects">
  162. <return type="bool">
  163. </return>
  164. <argument index="0" name="with" type="AABB">
  165. </argument>
  166. <description>
  167. Returns [code]true[/code] if the [AABB] overlaps with another.
  168. </description>
  169. </method>
  170. <method name="intersects_plane">
  171. <return type="bool">
  172. </return>
  173. <argument index="0" name="plane" type="Plane">
  174. </argument>
  175. <description>
  176. Returns [code]true[/code] if the [AABB] is on both sides of a plane.
  177. </description>
  178. </method>
  179. <method name="intersects_segment">
  180. <return type="bool">
  181. </return>
  182. <argument index="0" name="from" type="Vector3">
  183. </argument>
  184. <argument index="1" name="to" type="Vector3">
  185. </argument>
  186. <description>
  187. Returns [code]true[/code] if the [AABB] intersects the line segment between [code]from[/code] and [code]to[/code].
  188. </description>
  189. </method>
  190. <method name="is_equal_approx">
  191. <return type="bool">
  192. </return>
  193. <argument index="0" name="aabb" type="AABB">
  194. </argument>
  195. <description>
  196. Returns [code]true[/code] if this [AABB] and [code]aabb[/code] are approximately equal, by calling [method @GDScript.is_equal_approx] on each component.
  197. </description>
  198. </method>
  199. <method name="merge">
  200. <return type="AABB">
  201. </return>
  202. <argument index="0" name="with" type="AABB">
  203. </argument>
  204. <description>
  205. Returns a larger [AABB] that contains both this [AABB] and [code]with[/code].
  206. </description>
  207. </method>
  208. </methods>
  209. <members>
  210. <member name="end" type="Vector3" setter="" getter="" default="Vector3( 0, 0, 0 )">
  211. Ending corner. This is calculated as [code]position + size[/code]. Setting this value will change the size.
  212. </member>
  213. <member name="position" type="Vector3" setter="" getter="" default="Vector3( 0, 0, 0 )">
  214. Beginning corner. Typically has values lower than [member end].
  215. </member>
  216. <member name="size" type="Vector3" setter="" getter="" default="Vector3( 0, 0, 0 )">
  217. Size from [member position] to [member end]. Typically, all components are positive.
  218. If the size is negative, you can use [method abs] to fix it.
  219. </member>
  220. </members>
  221. <constants>
  222. </constants>
  223. </class>