summaryrefslogtreecommitdiff
path: root/doc/classes/Area.xml
blob: bbab7a5547484819b66945c66f499daf2c767e42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Area" inherits="CollisionObject" category="Core" version="3.0.alpha.custom_build">
	<brief_description>
		General purpose area node for detection and 3D physics influence.
	</brief_description>
	<description>
		3D area that detects [CollisionObject] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping).
	</description>
	<tutorials>
	</tutorials>
	<demos>
	</demos>
	<methods>
		<method name="get_angular_damp" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Return the angular damp rate.
			</description>
		</method>
		<method name="get_audio_bus" qualifiers="const">
			<return type="String">
			</return>
			<description>
			</description>
		</method>
		<method name="get_collision_layer" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Return the physics layer this area is in.
			</description>
		</method>
		<method name="get_collision_layer_bit" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<description>
				Return an individual bit on the layer mask.
			</description>
		</method>
		<method name="get_collision_mask" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Return the physics layers this area can scan for collisions.
			</description>
		</method>
		<method name="get_collision_mask_bit" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<description>
				Return an individual bit on the collision mask.
			</description>
		</method>
		<method name="get_gravity" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Return the gravity intensity.
			</description>
		</method>
		<method name="get_gravity_distance_scale" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Return the falloff factor for point gravity.
			</description>
		</method>
		<method name="get_gravity_vector" qualifiers="const">
			<return type="Vector3">
			</return>
			<description>
				Return the gravity vector. If gravity is a point (see [method is_gravity_a_point]), this will be the attraction center.
			</description>
		</method>
		<method name="get_linear_damp" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Return the linear damp rate.
			</description>
		</method>
		<method name="get_overlapping_areas" qualifiers="const">
			<return type="Array">
			</return>
			<description>
				Returns a list of intersecting [Area]s.
			</description>
		</method>
		<method name="get_overlapping_bodies" qualifiers="const">
			<return type="Array">
			</return>
			<description>
				Returns a list of intersecting [PhysicsBody]s.
			</description>
		</method>
		<method name="get_priority" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Return the processing order of this area.
			</description>
		</method>
		<method name="get_reverb_amount" qualifiers="const">
			<return type="float">
			</return>
			<description>
			</description>
		</method>
		<method name="get_reverb_bus" qualifiers="const">
			<return type="String">
			</return>
			<description>
			</description>
		</method>
		<method name="get_reverb_uniformity" qualifiers="const">
			<return type="float">
			</return>
			<description>
			</description>
		</method>
		<method name="get_space_override_mode" qualifiers="const">
			<return type="int" enum="Area.SpaceOverride">
			</return>
			<description>
				Return the space override mode.
			</description>
		</method>
		<method name="is_gravity_a_point" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				Return whether gravity is a point. A point gravity will attract objects towards it, as opposed to a gravity vector, which moves them in a given direction.
			</description>
		</method>
		<method name="is_monitorable" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				Return whether this area can be detected by other, monitoring, areas.
			</description>
		</method>
		<method name="is_monitoring" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				Return whether this area detects bodies/areas entering/exiting it.
			</description>
		</method>
		<method name="is_overriding_audio_bus" qualifiers="const">
			<return type="bool">
			</return>
			<description>
			</description>
		</method>
		<method name="is_using_reverb_bus" qualifiers="const">
			<return type="bool">
			</return>
			<description>
			</description>
		</method>
		<method name="overlaps_area" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="area" type="Node">
			</argument>
			<description>
				If [code]true[/code] the given area overlaps the Area.
			</description>
		</method>
		<method name="overlaps_body" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="body" type="Node">
			</argument>
			<description>
				If [code]true[/code] the given body overlaps the Area.
			</description>
		</method>
		<method name="set_angular_damp">
			<return type="void">
			</return>
			<argument index="0" name="angular_damp" type="float">
			</argument>
			<description>
				Set the rate at which objects stop spinning in this area, if there are not any other forces making it spin. The value is a fraction of its current speed, lost per second. Thus, a value of 1.0 should mean stopping immediately, and 0.0 means the object never stops.
				In practice, as the fraction of speed lost gets smaller with each frame, a value of 1.0 does not mean the object will stop in exactly one second. Only when the physics calculations are done at 1 frame per second, it does stop in a second.
			</description>
		</method>
		<method name="set_audio_bus">
			<return type="void">
			</return>
			<argument index="0" name="name" type="String">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_audio_bus_override">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_collision_layer">
			<return type="void">
			</return>
			<argument index="0" name="collision_layer" type="int">
			</argument>
			<description>
				Set the physics layers this area is in.
				Collidable objects can exist in any of 32 different layers. These layers are not visual, but more of a tagging system instead. A collidable can use these layers/tags to select with which objects it can collide, using [method set_collision_mask].
				A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A.
			</description>
		</method>
		<method name="set_collision_layer_bit">
			<return type="void">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<argument index="1" name="value" type="bool">
			</argument>
			<description>
				Set/clear individual bits on the layer mask. This makes getting an area in/out of only one layer easier.
			</description>
		</method>
		<method name="set_collision_mask">
			<return type="void">
			</return>
			<argument index="0" name="collision_mask" type="int">
			</argument>
			<description>
				Set the physics layers this area can scan for collisions.
			</description>
		</method>
		<method name="set_collision_mask_bit">
			<return type="void">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<argument index="1" name="value" type="bool">
			</argument>
			<description>
				Set/clear individual bits on the collision mask. This makes selecting the areas scanned easier.
			</description>
		</method>
		<method name="set_gravity">
			<return type="void">
			</return>
			<argument index="0" name="gravity" type="float">
			</argument>
			<description>
				Set the gravity intensity. This is useful to alter the force of gravity without altering its direction.
				This value multiplies the gravity vector, whether it is the given vector ([method set_gravity_vector]), or a calculated one (when using a center of gravity).
			</description>
		</method>
		<method name="set_gravity_distance_scale">
			<return type="void">
			</return>
			<argument index="0" name="distance_scale" type="float">
			</argument>
			<description>
				Set the falloff factor for point gravity. The greater this value is, the faster the strength of gravity decreases with the square of distance.
			</description>
		</method>
		<method name="set_gravity_is_point">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
				When overriding space parameters, this method sets whether this area has a center of gravity. To set/get the location of the center of gravity, use [method set_gravity_vector]/[method get_gravity_vector].
			</description>
		</method>
		<method name="set_gravity_vector">
			<return type="void">
			</return>
			<argument index="0" name="vector" type="Vector3">
			</argument>
			<description>
				Set the gravity vector. This vector does not have to be normalized.
				If gravity is a point (see [method is_gravity_a_point]), this will be the attraction center.
			</description>
		</method>
		<method name="set_linear_damp">
			<return type="void">
			</return>
			<argument index="0" name="linear_damp" type="float">
			</argument>
			<description>
				Set the rate at which objects stop moving in this area, if there are not any other forces moving it. The value is a fraction of its current speed, lost per second. Thus, a value of 1.0 should mean stopping immediately, and 0.0 means the object never stops.
				In practice, as the fraction of speed lost gets smaller with each frame, a value of 1.0 does not mean the object will stop in exactly one second. Only when the physics calculations are done at 1 frame per second, it does stop in a second.
			</description>
		</method>
		<method name="set_monitorable">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
				Set whether this area can be detected by other, monitoring, areas. Only areas need to be marked as monitorable. Bodies are always so.
			</description>
		</method>
		<method name="set_monitoring">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
				Set whether this area can detect bodies/areas entering/exiting it.
			</description>
		</method>
		<method name="set_priority">
			<return type="void">
			</return>
			<argument index="0" name="priority" type="float">
			</argument>
			<description>
				Set the order in which the area is processed. Greater values mean the area gets processed first. This is useful for areas which have a space override different from AREA_SPACE_OVERRIDE_DISABLED or AREA_SPACE_OVERRIDE_COMBINE, as they replace values, and are thus order-dependent.
				Areas with the same priority value get evaluated in an unpredictable order, and should be differentiated if evaluation order is to be important.
			</description>
		</method>
		<method name="set_reverb_amount">
			<return type="void">
			</return>
			<argument index="0" name="amount" type="float">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_reverb_bus">
			<return type="void">
			</return>
			<argument index="0" name="name" type="String">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_reverb_uniformity">
			<return type="void">
			</return>
			<argument index="0" name="amount" type="float">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_space_override_mode">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="int" enum="Area.SpaceOverride">
			</argument>
			<description>
				Set the space override mode. This mode controls how an area affects gravity and damp.
				AREA_SPACE_OVERRIDE_DISABLED: This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them.
				AREA_SPACE_OVERRIDE_COMBINE: This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects.
				AREA_SPACE_OVERRIDE_COMBINE_REPLACE: This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one.
				AREA_SPACE_OVERRIDE_REPLACE: This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas.
				AREA_SPACE_OVERRIDE_REPLACE_COMBINE: This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one.
			</description>
		</method>
		<method name="set_use_reverb_bus">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
			</description>
		</method>
	</methods>
	<members>
		<member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp">
			The rate at which objects stop spinning in this area. Represents the angular velocity lost per second. Values range from [code]0[/code] (no damping) to [code]1[/code] (full damping).
		</member>
		<member name="audio_bus_name" type="String" setter="set_audio_bus" getter="get_audio_bus">
			The name of the area's audio bus.
		</member>
		<member name="audio_bus_override" type="bool" setter="set_audio_bus_override" getter="is_overriding_audio_bus">
			If [code]true[/code] the area's audio bus overrides the default audio bus. Default value: [code]false[/code].
		</member>
		<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
			The area's physics layer(s). Collidable objects can exist in any of 32 different layers. A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See also [code]collision_mask[/code].
		</member>
		<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
			The physics layers this area scans to determine collision detection.
		</member>
		<member name="gravity" type="float" setter="set_gravity" getter="get_gravity">
			The area's gravity intensity (ranges from -1024 to 1024). This value multiplies the gravity vector. This is useful to alter the force of gravity without altering its direction.
		</member>
		<member name="gravity_distance_scale" type="float" setter="set_gravity_distance_scale" getter="get_gravity_distance_scale">
			The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.
		</member>
		<member name="gravity_point" type="bool" setter="set_gravity_is_point" getter="is_gravity_a_point">
			If [code]true[/code] gravity is calculated from a point (set via [code]gravity_vec[/code]). Also see [code]space_override[/code]. Default value: [code]false[/code].
		</member>
		<member name="gravity_vec" type="Vector3" setter="set_gravity_vector" getter="get_gravity_vector">
			The area's gravity vector (not normalized). If gravity is a point (see [method is_gravity_a_point]), this will be the point of attraction.
		</member>
		<member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp">
			The rate at which objects stop moving in this area. Represents the linear velocity lost per second. Values range from [code]0[/code] (no damping) to [code]1[/code] (full damping).
		</member>
		<member name="monitorable" type="bool" setter="set_monitorable" getter="is_monitorable">
			If [code]true[/code] other monitoring areas can detect this area. Default value: [code]true[/code].
		</member>
		<member name="monitoring" type="bool" setter="set_monitoring" getter="is_monitoring">
			If [code]true[/code] the area detects bodies or areas entering and exiting it. Default value: [code]true[/code].
		</member>
		<member name="priority" type="float" setter="set_priority" getter="get_priority">
			The area's priority. Higher priority areas are processed first. Default value: 0.
		</member>
		<member name="reverb_bus_amount" type="float" setter="set_reverb_amount" getter="get_reverb_amount">
		</member>
		<member name="reverb_bus_enable" type="bool" setter="set_use_reverb_bus" getter="is_using_reverb_bus">
		</member>
		<member name="reverb_bus_name" type="String" setter="set_reverb_bus" getter="get_reverb_bus">
		</member>
		<member name="reverb_bus_uniformity" type="float" setter="set_reverb_uniformity" getter="get_reverb_uniformity">
		</member>
		<member name="space_override" type="int" setter="set_space_override_mode" getter="get_space_override_mode" enum="Area.SpaceOverride">
			Override mode for gravity and damping calculations within this area. See the SPACE_OVERRIDE_* constants for values.
		</member>
	</members>
	<signals>
		<signal name="area_entered">
			<argument index="0" name="area" type="Object">
			</argument>
			<description>
				Emitted when another area enters.
			</description>
		</signal>
		<signal name="area_exited">
			<argument index="0" name="area" type="Object">
			</argument>
			<description>
				Emitted when another area exits.
			</description>
		</signal>
		<signal name="area_shape_entered">
			<argument index="0" name="area_id" type="int">
			</argument>
			<argument index="1" name="area" type="Object">
			</argument>
			<argument index="2" name="area_shape" type="int">
			</argument>
			<argument index="3" name="self_shape" type="int">
			</argument>
			<description>
				Emitted when another area enters, reporting which areas overlapped.
			</description>
		</signal>
		<signal name="area_shape_exited">
			<argument index="0" name="area_id" type="int">
			</argument>
			<argument index="1" name="area" type="Object">
			</argument>
			<argument index="2" name="area_shape" type="int">
			</argument>
			<argument index="3" name="self_shape" type="int">
			</argument>
			<description>
				Emitted when another area exits, reporting which areas were overlapping.
			</description>
		</signal>
		<signal name="body_entered">
			<argument index="0" name="body" type="Object">
			</argument>
			<description>
				Emitted when a [PhysicsBody] object enters.
			</description>
		</signal>
		<signal name="body_exited">
			<argument index="0" name="body" type="Object">
			</argument>
			<description>
				Emitted when a [PhysicsBody2D] object exits.
			</description>
		</signal>
		<signal name="body_shape_entered">
			<argument index="0" name="body_id" type="int">
			</argument>
			<argument index="1" name="body" type="Object">
			</argument>
			<argument index="2" name="body_shape" type="int">
			</argument>
			<argument index="3" name="area_shape" type="int">
			</argument>
			<description>
				Emitted when a [PhysicsBody2D] object enters, reporting which shapes overlapped.
			</description>
		</signal>
		<signal name="body_shape_exited">
			<argument index="0" name="body_id" type="int">
			</argument>
			<argument index="1" name="body" type="Object">
			</argument>
			<argument index="2" name="body_shape" type="int">
			</argument>
			<argument index="3" name="area_shape" type="int">
			</argument>
			<description>
				Emitted when a [PhysicsBody2D] object exits, reporting which shapes were overlapping.
			</description>
		</signal>
	</signals>
	<constants>
		<constant name="SPACE_OVERRIDE_DISABLED" value="0">
			This area does not affect gravity/damping.
		</constant>
		<constant name="SPACE_OVERRIDE_COMBINE" value="1">
			This area adds its gravity/damping values to whatever has been calculated so far (in [code]priority[/code] order).
		</constant>
		<constant name="SPACE_OVERRIDE_COMBINE_REPLACE" value="2">
			This area adds its gravity/damping values to whatever has been calculated so far (in [code]priority[/code] order), ignoring any lower priority areas.
		</constant>
		<constant name="SPACE_OVERRIDE_REPLACE" value="3">
			This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas.
		</constant>
		<constant name="SPACE_OVERRIDE_REPLACE_COMBINE" value="4">
			This area replaces any gravity/damping calculated so far (in [code]priority[/code] order), but keeps calculating the rest of the areas.
		</constant>
	</constants>
</class>