2
0

class_area2d.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/Area2D.xml.
  6. .. _class_Area2D:
  7. Area2D
  8. ======
  9. **Inherits:** :ref:`CollisionObject2D<class_CollisionObject2D>` **<** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. 2D area for detection and physics and audio influence.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 2D area that detects :ref:`CollisionObject2D<class_CollisionObject2D>` nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping) and route audio to a custom audio bus.
  15. To give the area its shape, add a :ref:`CollisionShape2D<class_CollisionShape2D>` or a :ref:`CollisionPolygon2D<class_CollisionPolygon2D>` node as a *direct* child (or add multiple such nodes as direct children) of the area.
  16. \ **Warning:** See :ref:`ConcavePolygonShape2D<class_ConcavePolygonShape2D>` for a warning about possibly unexpected behavior when using that shape for an area.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`Using Area2D <../tutorials/physics/using_area_2d>`
  21. - `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/515>`__
  22. - `2D Pong Demo <https://godotengine.org/asset-library/asset/121>`__
  23. - `2D Platformer Demo <https://godotengine.org/asset-library/asset/120>`__
  24. .. rst-class:: classref-reftable-group
  25. Properties
  26. ----------
  27. .. table::
  28. :widths: auto
  29. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  30. | :ref:`float<class_float>` | :ref:`angular_damp<class_Area2D_property_angular_damp>` | ``1.0`` |
  31. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  32. | :ref:`String<class_String>` | :ref:`audio_bus_name<class_Area2D_property_audio_bus_name>` | ``"Master"`` |
  33. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  34. | :ref:`bool<class_bool>` | :ref:`audio_bus_override<class_Area2D_property_audio_bus_override>` | ``false`` |
  35. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  36. | :ref:`float<class_float>` | :ref:`gravity<class_Area2D_property_gravity>` | ``98.0`` |
  37. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  38. | :ref:`float<class_float>` | :ref:`gravity_distance_scale<class_Area2D_property_gravity_distance_scale>` | ``0.0`` |
  39. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  40. | :ref:`bool<class_bool>` | :ref:`gravity_point<class_Area2D_property_gravity_point>` | ``false`` |
  41. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  42. | :ref:`Vector2<class_Vector2>` | :ref:`gravity_vec<class_Area2D_property_gravity_vec>` | ``Vector2( 0, 1 )`` |
  43. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  44. | :ref:`float<class_float>` | :ref:`linear_damp<class_Area2D_property_linear_damp>` | ``0.1`` |
  45. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  46. | :ref:`bool<class_bool>` | :ref:`monitorable<class_Area2D_property_monitorable>` | ``true`` |
  47. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  48. | :ref:`bool<class_bool>` | :ref:`monitoring<class_Area2D_property_monitoring>` | ``true`` |
  49. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  50. | :ref:`float<class_float>` | :ref:`priority<class_Area2D_property_priority>` | ``0.0`` |
  51. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  52. | :ref:`SpaceOverride<enum_Area2D_SpaceOverride>` | :ref:`space_override<class_Area2D_property_space_override>` | ``0`` |
  53. +-------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
  54. .. rst-class:: classref-reftable-group
  55. Methods
  56. -------
  57. .. table::
  58. :widths: auto
  59. +---------------------------+----------------------------------------------------------------------------------------------------------+
  60. | :ref:`Array<class_Array>` | :ref:`get_overlapping_areas<class_Area2D_method_get_overlapping_areas>` **(** **)** |const| |
  61. +---------------------------+----------------------------------------------------------------------------------------------------------+
  62. | :ref:`Array<class_Array>` | :ref:`get_overlapping_bodies<class_Area2D_method_get_overlapping_bodies>` **(** **)** |const| |
  63. +---------------------------+----------------------------------------------------------------------------------------------------------+
  64. | :ref:`bool<class_bool>` | :ref:`overlaps_area<class_Area2D_method_overlaps_area>` **(** :ref:`Node<class_Node>` area **)** |const| |
  65. +---------------------------+----------------------------------------------------------------------------------------------------------+
  66. | :ref:`bool<class_bool>` | :ref:`overlaps_body<class_Area2D_method_overlaps_body>` **(** :ref:`Node<class_Node>` body **)** |const| |
  67. +---------------------------+----------------------------------------------------------------------------------------------------------+
  68. .. rst-class:: classref-section-separator
  69. ----
  70. .. rst-class:: classref-descriptions-group
  71. Signals
  72. -------
  73. .. _class_Area2D_signal_area_entered:
  74. .. rst-class:: classref-signal
  75. **area_entered** **(** :ref:`Area2D<class_Area2D>` area **)**
  76. Emitted when another Area2D enters this Area2D. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``.
  77. \ ``area`` the other Area2D.
  78. .. rst-class:: classref-item-separator
  79. ----
  80. .. _class_Area2D_signal_area_exited:
  81. .. rst-class:: classref-signal
  82. **area_exited** **(** :ref:`Area2D<class_Area2D>` area **)**
  83. Emitted when another Area2D exits this Area2D. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``.
  84. \ ``area`` the other Area2D.
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _class_Area2D_signal_area_shape_entered:
  88. .. rst-class:: classref-signal
  89. **area_shape_entered** **(** :ref:`RID<class_RID>` area_rid, :ref:`Area2D<class_Area2D>` area, :ref:`int<class_int>` area_shape_index, :ref:`int<class_int>` local_shape_index **)**
  90. Emitted when one of another Area2D's :ref:`Shape2D<class_Shape2D>`\ s enters one of this Area2D's :ref:`Shape2D<class_Shape2D>`\ s. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``.
  91. \ ``area_rid`` the :ref:`RID<class_RID>` of the other Area2D's :ref:`CollisionObject2D<class_CollisionObject2D>` used by the :ref:`Physics2DServer<class_Physics2DServer>`.
  92. \ ``area`` the other Area2D.
  93. \ ``area_shape_index`` the index of the :ref:`Shape2D<class_Shape2D>` of the other Area2D used by the :ref:`Physics2DServer<class_Physics2DServer>`. Get the :ref:`CollisionShape2D<class_CollisionShape2D>` node with ``area.shape_owner_get_owner(area_shape_index)``.
  94. \ ``local_shape_index`` the index of the :ref:`Shape2D<class_Shape2D>` of this Area2D used by the :ref:`Physics2DServer<class_Physics2DServer>`. Get the :ref:`CollisionShape2D<class_CollisionShape2D>` node with ``self.shape_owner_get_owner(local_shape_index)``.
  95. .. rst-class:: classref-item-separator
  96. ----
  97. .. _class_Area2D_signal_area_shape_exited:
  98. .. rst-class:: classref-signal
  99. **area_shape_exited** **(** :ref:`RID<class_RID>` area_rid, :ref:`Area2D<class_Area2D>` area, :ref:`int<class_int>` area_shape_index, :ref:`int<class_int>` local_shape_index **)**
  100. Emitted when one of another Area2D's :ref:`Shape2D<class_Shape2D>`\ s exits one of this Area2D's :ref:`Shape2D<class_Shape2D>`\ s. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``.
  101. \ ``area_rid`` the :ref:`RID<class_RID>` of the other Area2D's :ref:`CollisionObject2D<class_CollisionObject2D>` used by the :ref:`Physics2DServer<class_Physics2DServer>`.
  102. \ ``area`` the other Area2D.
  103. \ ``area_shape_index`` the index of the :ref:`Shape2D<class_Shape2D>` of the other Area2D used by the :ref:`Physics2DServer<class_Physics2DServer>`. Get the :ref:`CollisionShape2D<class_CollisionShape2D>` node with ``area.shape_owner_get_owner(area_shape_index)``.
  104. \ ``local_shape_index`` the index of the :ref:`Shape2D<class_Shape2D>` of this Area2D used by the :ref:`Physics2DServer<class_Physics2DServer>`. Get the :ref:`CollisionShape2D<class_CollisionShape2D>` node with ``self.shape_owner_get_owner(local_shape_index)``.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_Area2D_signal_body_entered:
  108. .. rst-class:: classref-signal
  109. **body_entered** **(** :ref:`Node<class_Node>` body **)**
  110. Emitted when a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>` enters this Area2D. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``. :ref:`TileMap<class_TileMap>`\ s are detected if the :ref:`TileSet<class_TileSet>` has Collision :ref:`Shape2D<class_Shape2D>`\ s.
  111. \ ``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the other :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`.
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_Area2D_signal_body_exited:
  115. .. rst-class:: classref-signal
  116. **body_exited** **(** :ref:`Node<class_Node>` body **)**
  117. Emitted when a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>` exits this Area2D. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``. :ref:`TileMap<class_TileMap>`\ s are detected if the :ref:`TileSet<class_TileSet>` has Collision :ref:`Shape2D<class_Shape2D>`\ s.
  118. \ ``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the other :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`.
  119. .. rst-class:: classref-item-separator
  120. ----
  121. .. _class_Area2D_signal_body_shape_entered:
  122. .. rst-class:: classref-signal
  123. **body_shape_entered** **(** :ref:`RID<class_RID>` body_rid, :ref:`Node<class_Node>` body, :ref:`int<class_int>` body_shape_index, :ref:`int<class_int>` local_shape_index **)**
  124. Emitted when one of a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`'s :ref:`Shape2D<class_Shape2D>`\ s enters one of this Area2D's :ref:`Shape2D<class_Shape2D>`\ s. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``. :ref:`TileMap<class_TileMap>`\ s are detected if the :ref:`TileSet<class_TileSet>` has Collision :ref:`Shape2D<class_Shape2D>`\ s.
  125. \ ``body_rid`` the :ref:`RID<class_RID>` of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileSet<class_TileSet>`'s :ref:`CollisionObject2D<class_CollisionObject2D>` used by the :ref:`Physics2DServer<class_Physics2DServer>`.
  126. \ ``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`.
  127. \ ``body_shape_index`` the index of the :ref:`Shape2D<class_Shape2D>` of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>` used by the :ref:`Physics2DServer<class_Physics2DServer>`. Get the :ref:`CollisionShape2D<class_CollisionShape2D>` node with ``body.shape_owner_get_owner(body_shape_index)``.
  128. \ ``local_shape_index`` the index of the :ref:`Shape2D<class_Shape2D>` of this Area2D used by the :ref:`Physics2DServer<class_Physics2DServer>`. Get the :ref:`CollisionShape2D<class_CollisionShape2D>` node with ``self.shape_owner_get_owner(local_shape_index)``.
  129. .. rst-class:: classref-item-separator
  130. ----
  131. .. _class_Area2D_signal_body_shape_exited:
  132. .. rst-class:: classref-signal
  133. **body_shape_exited** **(** :ref:`RID<class_RID>` body_rid, :ref:`Node<class_Node>` body, :ref:`int<class_int>` body_shape_index, :ref:`int<class_int>` local_shape_index **)**
  134. Emitted when one of a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`'s :ref:`Shape2D<class_Shape2D>`\ s exits one of this Area2D's :ref:`Shape2D<class_Shape2D>`\ s. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``. :ref:`TileMap<class_TileMap>`\ s are detected if the :ref:`TileSet<class_TileSet>` has Collision :ref:`Shape2D<class_Shape2D>`\ s.
  135. \ ``body_rid`` the :ref:`RID<class_RID>` of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileSet<class_TileSet>`'s :ref:`CollisionObject2D<class_CollisionObject2D>` used by the :ref:`Physics2DServer<class_Physics2DServer>`.
  136. \ ``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`.
  137. \ ``body_shape_index`` the index of the :ref:`Shape2D<class_Shape2D>` of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>` used by the :ref:`Physics2DServer<class_Physics2DServer>`. Get the :ref:`CollisionShape2D<class_CollisionShape2D>` node with ``body.shape_owner_get_owner(body_shape_index)``.
  138. \ ``local_shape_index`` the index of the :ref:`Shape2D<class_Shape2D>` of this Area2D used by the :ref:`Physics2DServer<class_Physics2DServer>`. Get the :ref:`CollisionShape2D<class_CollisionShape2D>` node with ``self.shape_owner_get_owner(local_shape_index)``.
  139. .. rst-class:: classref-section-separator
  140. ----
  141. .. rst-class:: classref-descriptions-group
  142. Enumerations
  143. ------------
  144. .. _enum_Area2D_SpaceOverride:
  145. .. rst-class:: classref-enumeration
  146. enum **SpaceOverride**:
  147. .. _class_Area2D_constant_SPACE_OVERRIDE_DISABLED:
  148. .. rst-class:: classref-enumeration-constant
  149. :ref:`SpaceOverride<enum_Area2D_SpaceOverride>` **SPACE_OVERRIDE_DISABLED** = ``0``
  150. This area does not affect gravity/damping.
  151. .. _class_Area2D_constant_SPACE_OVERRIDE_COMBINE:
  152. .. rst-class:: classref-enumeration-constant
  153. :ref:`SpaceOverride<enum_Area2D_SpaceOverride>` **SPACE_OVERRIDE_COMBINE** = ``1``
  154. This area adds its gravity/damping values to whatever has been calculated so far (in :ref:`priority<class_Area2D_property_priority>` order).
  155. .. _class_Area2D_constant_SPACE_OVERRIDE_COMBINE_REPLACE:
  156. .. rst-class:: classref-enumeration-constant
  157. :ref:`SpaceOverride<enum_Area2D_SpaceOverride>` **SPACE_OVERRIDE_COMBINE_REPLACE** = ``2``
  158. This area adds its gravity/damping values to whatever has been calculated so far (in :ref:`priority<class_Area2D_property_priority>` order), ignoring any lower priority areas.
  159. .. _class_Area2D_constant_SPACE_OVERRIDE_REPLACE:
  160. .. rst-class:: classref-enumeration-constant
  161. :ref:`SpaceOverride<enum_Area2D_SpaceOverride>` **SPACE_OVERRIDE_REPLACE** = ``3``
  162. This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas.
  163. .. _class_Area2D_constant_SPACE_OVERRIDE_REPLACE_COMBINE:
  164. .. rst-class:: classref-enumeration-constant
  165. :ref:`SpaceOverride<enum_Area2D_SpaceOverride>` **SPACE_OVERRIDE_REPLACE_COMBINE** = ``4``
  166. This area replaces any gravity/damping calculated so far (in :ref:`priority<class_Area2D_property_priority>` order), but keeps calculating the rest of the areas.
  167. .. rst-class:: classref-section-separator
  168. ----
  169. .. rst-class:: classref-descriptions-group
  170. Property Descriptions
  171. ---------------------
  172. .. _class_Area2D_property_angular_damp:
  173. .. rst-class:: classref-property
  174. :ref:`float<class_float>` **angular_damp** = ``1.0``
  175. .. rst-class:: classref-property-setget
  176. - void **set_angular_damp** **(** :ref:`float<class_float>` value **)**
  177. - :ref:`float<class_float>` **get_angular_damp** **(** **)**
  178. The rate at which objects stop spinning in this area. Represents the angular velocity lost per second.
  179. See :ref:`ProjectSettings.physics/2d/default_angular_damp<class_ProjectSettings_property_physics/2d/default_angular_damp>` for more details about damping.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_Area2D_property_audio_bus_name:
  183. .. rst-class:: classref-property
  184. :ref:`String<class_String>` **audio_bus_name** = ``"Master"``
  185. .. rst-class:: classref-property-setget
  186. - void **set_audio_bus_name** **(** :ref:`String<class_String>` value **)**
  187. - :ref:`String<class_String>` **get_audio_bus_name** **(** **)**
  188. The name of the area's audio bus.
  189. .. rst-class:: classref-item-separator
  190. ----
  191. .. _class_Area2D_property_audio_bus_override:
  192. .. rst-class:: classref-property
  193. :ref:`bool<class_bool>` **audio_bus_override** = ``false``
  194. .. rst-class:: classref-property-setget
  195. - void **set_audio_bus_override** **(** :ref:`bool<class_bool>` value **)**
  196. - :ref:`bool<class_bool>` **is_overriding_audio_bus** **(** **)**
  197. If ``true``, the area's audio bus overrides the default audio bus.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_Area2D_property_gravity:
  201. .. rst-class:: classref-property
  202. :ref:`float<class_float>` **gravity** = ``98.0``
  203. .. rst-class:: classref-property-setget
  204. - void **set_gravity** **(** :ref:`float<class_float>` value **)**
  205. - :ref:`float<class_float>` **get_gravity** **(** **)**
  206. The area's gravity intensity (in pixels per second squared). This value multiplies the gravity vector. This is useful to alter the force of gravity without altering its direction.
  207. .. rst-class:: classref-item-separator
  208. ----
  209. .. _class_Area2D_property_gravity_distance_scale:
  210. .. rst-class:: classref-property
  211. :ref:`float<class_float>` **gravity_distance_scale** = ``0.0``
  212. .. rst-class:: classref-property-setget
  213. - void **set_gravity_distance_scale** **(** :ref:`float<class_float>` value **)**
  214. - :ref:`float<class_float>` **get_gravity_distance_scale** **(** **)**
  215. The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_Area2D_property_gravity_point:
  219. .. rst-class:: classref-property
  220. :ref:`bool<class_bool>` **gravity_point** = ``false``
  221. .. rst-class:: classref-property-setget
  222. - void **set_gravity_is_point** **(** :ref:`bool<class_bool>` value **)**
  223. - :ref:`bool<class_bool>` **is_gravity_a_point** **(** **)**
  224. If ``true``, gravity is calculated from a point (set via :ref:`gravity_vec<class_Area2D_property_gravity_vec>`). See also :ref:`space_override<class_Area2D_property_space_override>`.
  225. .. rst-class:: classref-item-separator
  226. ----
  227. .. _class_Area2D_property_gravity_vec:
  228. .. rst-class:: classref-property
  229. :ref:`Vector2<class_Vector2>` **gravity_vec** = ``Vector2( 0, 1 )``
  230. .. rst-class:: classref-property-setget
  231. - void **set_gravity_vector** **(** :ref:`Vector2<class_Vector2>` value **)**
  232. - :ref:`Vector2<class_Vector2>` **get_gravity_vector** **(** **)**
  233. The area's gravity vector (not normalized). If gravity is a point (see :ref:`gravity_point<class_Area2D_property_gravity_point>`), this will be the point of attraction.
  234. .. rst-class:: classref-item-separator
  235. ----
  236. .. _class_Area2D_property_linear_damp:
  237. .. rst-class:: classref-property
  238. :ref:`float<class_float>` **linear_damp** = ``0.1``
  239. .. rst-class:: classref-property-setget
  240. - void **set_linear_damp** **(** :ref:`float<class_float>` value **)**
  241. - :ref:`float<class_float>` **get_linear_damp** **(** **)**
  242. The rate at which objects stop moving in this area. Represents the linear velocity lost per second.
  243. See :ref:`ProjectSettings.physics/2d/default_linear_damp<class_ProjectSettings_property_physics/2d/default_linear_damp>` for more details about damping.
  244. .. rst-class:: classref-item-separator
  245. ----
  246. .. _class_Area2D_property_monitorable:
  247. .. rst-class:: classref-property
  248. :ref:`bool<class_bool>` **monitorable** = ``true``
  249. .. rst-class:: classref-property-setget
  250. - void **set_monitorable** **(** :ref:`bool<class_bool>` value **)**
  251. - :ref:`bool<class_bool>` **is_monitorable** **(** **)**
  252. If ``true``, other monitoring areas can detect this area.
  253. .. rst-class:: classref-item-separator
  254. ----
  255. .. _class_Area2D_property_monitoring:
  256. .. rst-class:: classref-property
  257. :ref:`bool<class_bool>` **monitoring** = ``true``
  258. .. rst-class:: classref-property-setget
  259. - void **set_monitoring** **(** :ref:`bool<class_bool>` value **)**
  260. - :ref:`bool<class_bool>` **is_monitoring** **(** **)**
  261. If ``true``, the area detects bodies or areas entering and exiting it.
  262. .. rst-class:: classref-item-separator
  263. ----
  264. .. _class_Area2D_property_priority:
  265. .. rst-class:: classref-property
  266. :ref:`float<class_float>` **priority** = ``0.0``
  267. .. rst-class:: classref-property-setget
  268. - void **set_priority** **(** :ref:`float<class_float>` value **)**
  269. - :ref:`float<class_float>` **get_priority** **(** **)**
  270. The area's priority. Higher priority areas are processed first.
  271. .. rst-class:: classref-item-separator
  272. ----
  273. .. _class_Area2D_property_space_override:
  274. .. rst-class:: classref-property
  275. :ref:`SpaceOverride<enum_Area2D_SpaceOverride>` **space_override** = ``0``
  276. .. rst-class:: classref-property-setget
  277. - void **set_space_override_mode** **(** :ref:`SpaceOverride<enum_Area2D_SpaceOverride>` value **)**
  278. - :ref:`SpaceOverride<enum_Area2D_SpaceOverride>` **get_space_override_mode** **(** **)**
  279. Override mode for gravity and damping calculations within this area. See :ref:`SpaceOverride<enum_Area2D_SpaceOverride>` for possible values.
  280. .. rst-class:: classref-section-separator
  281. ----
  282. .. rst-class:: classref-descriptions-group
  283. Method Descriptions
  284. -------------------
  285. .. _class_Area2D_method_get_overlapping_areas:
  286. .. rst-class:: classref-method
  287. :ref:`Array<class_Array>` **get_overlapping_areas** **(** **)** |const|
  288. Returns a list of intersecting **Area2D**\ s. The overlapping area's :ref:`CollisionObject2D.collision_layer<class_CollisionObject2D_property_collision_layer>` must be part of this area's :ref:`CollisionObject2D.collision_mask<class_CollisionObject2D_property_collision_mask>` in order to be detected.
  289. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
  290. .. rst-class:: classref-item-separator
  291. ----
  292. .. _class_Area2D_method_get_overlapping_bodies:
  293. .. rst-class:: classref-method
  294. :ref:`Array<class_Array>` **get_overlapping_bodies** **(** **)** |const|
  295. Returns a list of intersecting :ref:`PhysicsBody2D<class_PhysicsBody2D>`\ s. The overlapping body's :ref:`CollisionObject2D.collision_layer<class_CollisionObject2D_property_collision_layer>` must be part of this area's :ref:`CollisionObject2D.collision_mask<class_CollisionObject2D_property_collision_mask>` in order to be detected.
  296. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
  297. .. rst-class:: classref-item-separator
  298. ----
  299. .. _class_Area2D_method_overlaps_area:
  300. .. rst-class:: classref-method
  301. :ref:`bool<class_bool>` **overlaps_area** **(** :ref:`Node<class_Node>` area **)** |const|
  302. If ``true``, the given area overlaps the Area2D.
  303. \ **Note:** The result of this test is not immediate after moving objects. For performance, the list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
  304. .. rst-class:: classref-item-separator
  305. ----
  306. .. _class_Area2D_method_overlaps_body:
  307. .. rst-class:: classref-method
  308. :ref:`bool<class_bool>` **overlaps_body** **(** :ref:`Node<class_Node>` body **)** |const|
  309. If ``true``, the given physics body overlaps the Area2D.
  310. \ **Note:** The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
  311. The ``body`` argument can either be a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or a :ref:`TileMap<class_TileMap>` instance (while TileMaps are not physics bodies themselves, they register their tiles with collision shapes as a virtual physics body).
  312. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  313. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  314. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  315. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`