AABB.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="AABB" version="4.0">
  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 documentation index">https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>
  13. <link title="Vector math">https://docs.godotengine.org/en/latest/tutorials/math/vector_math.html</link>
  14. <link title="Advanced vector math">https://docs.godotengine.org/en/latest/tutorials/math/vectors_advanced.html</link>
  15. </tutorials>
  16. <constructors>
  17. <constructor name="AABB">
  18. <return type="AABB" />
  19. <description>
  20. Constructs a default-initialized [AABB] with default (zero) values of [member position] and [member size].
  21. </description>
  22. </constructor>
  23. <constructor name="AABB">
  24. <return type="AABB" />
  25. <argument index="0" name="from" type="AABB" />
  26. <description>
  27. Constructs an [AABB] as a copy of the given [AABB].
  28. </description>
  29. </constructor>
  30. <constructor name="AABB">
  31. <return type="AABB" />
  32. <argument index="0" name="position" type="Vector3" />
  33. <argument index="1" name="size" type="Vector3" />
  34. <description>
  35. Constructs an [AABB] from a position and size.
  36. </description>
  37. </constructor>
  38. </constructors>
  39. <methods>
  40. <method name="abs" qualifiers="const">
  41. <return type="AABB" />
  42. <description>
  43. Returns an AABB with equivalent position and size, modified so that the most-negative corner is the origin and the size is positive.
  44. </description>
  45. </method>
  46. <method name="encloses" qualifiers="const">
  47. <return type="bool" />
  48. <argument index="0" name="with" type="AABB" />
  49. <description>
  50. Returns [code]true[/code] if this [AABB] completely encloses another one.
  51. </description>
  52. </method>
  53. <method name="expand" qualifiers="const">
  54. <return type="AABB" />
  55. <argument index="0" name="to_point" type="Vector3" />
  56. <description>
  57. Returns this [AABB] expanded to include a given point.
  58. </description>
  59. </method>
  60. <method name="get_center" qualifiers="const">
  61. <return type="Vector3" />
  62. <description>
  63. Returns the center of the [AABB], which is equal to [member position] + ([member size] / 2).
  64. </description>
  65. </method>
  66. <method name="get_endpoint" qualifiers="const">
  67. <return type="Vector3" />
  68. <argument index="0" name="idx" type="int" />
  69. <description>
  70. Gets the position of the 8 endpoints of the [AABB] in space.
  71. </description>
  72. </method>
  73. <method name="get_longest_axis" qualifiers="const">
  74. <return type="Vector3" />
  75. <description>
  76. Returns the normalized longest axis of the [AABB].
  77. </description>
  78. </method>
  79. <method name="get_longest_axis_index" qualifiers="const">
  80. <return type="int" />
  81. <description>
  82. Returns the index of the longest axis of the [AABB] (according to [Vector3]'s [code]AXIS_*[/code] constants).
  83. </description>
  84. </method>
  85. <method name="get_longest_axis_size" qualifiers="const">
  86. <return type="float" />
  87. <description>
  88. Returns the scalar length of the longest axis of the [AABB].
  89. </description>
  90. </method>
  91. <method name="get_shortest_axis" qualifiers="const">
  92. <return type="Vector3" />
  93. <description>
  94. Returns the normalized shortest axis of the [AABB].
  95. </description>
  96. </method>
  97. <method name="get_shortest_axis_index" qualifiers="const">
  98. <return type="int" />
  99. <description>
  100. Returns the index of the shortest axis of the [AABB] (according to [Vector3]::AXIS* enum).
  101. </description>
  102. </method>
  103. <method name="get_shortest_axis_size" qualifiers="const">
  104. <return type="float" />
  105. <description>
  106. Returns the scalar length of the shortest axis of the [AABB].
  107. </description>
  108. </method>
  109. <method name="get_support" qualifiers="const">
  110. <return type="Vector3" />
  111. <argument index="0" name="dir" type="Vector3" />
  112. <description>
  113. Returns the support point in a given direction. This is useful for collision detection algorithms.
  114. </description>
  115. </method>
  116. <method name="get_volume" qualifiers="const">
  117. <return type="float" />
  118. <description>
  119. Returns the volume of the [AABB].
  120. </description>
  121. </method>
  122. <method name="grow" qualifiers="const">
  123. <return type="AABB" />
  124. <argument index="0" name="by" type="float" />
  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_surface" qualifiers="const">
  130. <return type="bool" />
  131. <description>
  132. Returns [code]true[/code] if the [AABB] is empty.
  133. </description>
  134. </method>
  135. <method name="has_no_volume" qualifiers="const">
  136. <return type="bool" />
  137. <description>
  138. Returns [code]true[/code] if the [AABB] is flat or empty.
  139. </description>
  140. </method>
  141. <method name="has_point" qualifiers="const">
  142. <return type="bool" />
  143. <argument index="0" name="point" type="Vector3" />
  144. <description>
  145. Returns [code]true[/code] if the [AABB] contains a point.
  146. </description>
  147. </method>
  148. <method name="intersection" qualifiers="const">
  149. <return type="AABB" />
  150. <argument index="0" name="with" type="AABB" />
  151. <description>
  152. Returns the intersection between two [AABB]. An empty AABB (size 0,0,0) is returned on failure.
  153. </description>
  154. </method>
  155. <method name="intersects" qualifiers="const">
  156. <return type="bool" />
  157. <argument index="0" name="with" type="AABB" />
  158. <description>
  159. Returns [code]true[/code] if the [AABB] overlaps with another.
  160. </description>
  161. </method>
  162. <method name="intersects_plane" qualifiers="const">
  163. <return type="bool" />
  164. <argument index="0" name="plane" type="Plane" />
  165. <description>
  166. Returns [code]true[/code] if the [AABB] is on both sides of a plane.
  167. </description>
  168. </method>
  169. <method name="intersects_ray" qualifiers="const">
  170. <return type="Variant" />
  171. <argument index="0" name="from" type="Vector3" />
  172. <argument index="1" name="dir" type="Vector3" />
  173. <description>
  174. </description>
  175. </method>
  176. <method name="intersects_segment" qualifiers="const">
  177. <return type="Variant" />
  178. <argument index="0" name="from" type="Vector3" />
  179. <argument index="1" name="to" type="Vector3" />
  180. <description>
  181. Returns [code]true[/code] if the [AABB] intersects the line segment between [code]from[/code] and [code]to[/code].
  182. </description>
  183. </method>
  184. <method name="is_equal_approx" qualifiers="const">
  185. <return type="bool" />
  186. <argument index="0" name="aabb" type="AABB" />
  187. <description>
  188. Returns [code]true[/code] if this [AABB] and [code]aabb[/code] are approximately equal, by calling [method @GlobalScope.is_equal_approx] on each component.
  189. </description>
  190. </method>
  191. <method name="merge" qualifiers="const">
  192. <return type="AABB" />
  193. <argument index="0" name="with" type="AABB" />
  194. <description>
  195. Returns a larger [AABB] that contains both this [AABB] and [code]with[/code].
  196. </description>
  197. </method>
  198. </methods>
  199. <members>
  200. <member name="end" type="Vector3" setter="" getter="" default="Vector3(0, 0, 0)">
  201. Ending corner. This is calculated as [code]position + size[/code]. Setting this value will change the size.
  202. </member>
  203. <member name="position" type="Vector3" setter="" getter="" default="Vector3(0, 0, 0)">
  204. Beginning corner. Typically has values lower than [member end].
  205. </member>
  206. <member name="size" type="Vector3" setter="" getter="" default="Vector3(0, 0, 0)">
  207. Size from [member position] to [member end]. Typically, all components are positive.
  208. If the size is negative, you can use [method abs] to fix it.
  209. </member>
  210. </members>
  211. <operators>
  212. <operator name="operator !=">
  213. <return type="bool" />
  214. <description>
  215. </description>
  216. </operator>
  217. <operator name="operator !=">
  218. <return type="bool" />
  219. <argument index="0" name="right" type="AABB" />
  220. <description>
  221. </description>
  222. </operator>
  223. <operator name="operator *">
  224. <return type="AABB" />
  225. <argument index="0" name="right" type="Transform3D" />
  226. <description>
  227. </description>
  228. </operator>
  229. <operator name="operator ==">
  230. <return type="bool" />
  231. <description>
  232. </description>
  233. </operator>
  234. <operator name="operator ==">
  235. <return type="bool" />
  236. <argument index="0" name="right" type="AABB" />
  237. <description>
  238. </description>
  239. </operator>
  240. </operators>
  241. </class>