summaryrefslogtreecommitdiff
path: root/doc/classes/Area2D.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Area2D.xml')
-rw-r--r--doc/classes/Area2D.xml465
1 files changed, 465 insertions, 0 deletions
diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml
new file mode 100644
index 0000000000..e093b5cb49
--- /dev/null
+++ b/doc/classes/Area2D.xml
@@ -0,0 +1,465 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="Area2D" inherits="CollisionObject2D" category="Core" version="3.0.alpha.custom_build">
+ <brief_description>
+ 2D area that detects nodes that enter or exit it. Can override 2D physics properties within range.
+ </brief_description>
+ <description>
+ 2D area that detects nodes that enter or exit it. Change the 'space_override' property SPACE_OVERRIDE_* to override physics parameters for nodes like [Rigidbody2D]. E.g. gravity, damping... See [CollisionObject2D] for usage.
+ </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. Describes whether other areas will collide with this one on the given layer.
+ </description>
+ </method>
+ <method name="get_collision_mask" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Return the physics layers this area will scan to determine 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. Describes whether this area will collide with others on the given layer.
+ </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="Vector2">
+ </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 the [Area2D]s that intersect with this area.
+ </description>
+ </method>
+ <method name="get_overlapping_bodies" qualifiers="const">
+ <return type="Array">
+ </return>
+ <description>
+ Return a list of the [PhysicsBody2D]s that intersect with this area.
+ </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_space_override_mode" qualifiers="const">
+ <return type="int" enum="Area2D.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="overlaps_area" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="area" type="Node">
+ </argument>
+ <description>
+ Return whether the area passed is totally or partially inside this area.
+ </description>
+ </method>
+ <method name="overlaps_body" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="body" type="Node">
+ </argument>
+ <description>
+ Return whether the body passed is totally or partially inside this 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="Vector2">
+ </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_space_override_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="space_override_mode" type="int" enum="Area2D.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>
+ </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 amount of speed lost per second. If 1.0, physics bodies in the area stop rotating immediately. If 0.0, they never slow down. Does not incorporate external forces. The physics-update's rate affects 'angular_damp'.
+ </member>
+ <member name="audio_bus_name" type="String" setter="set_audio_bus" getter="get_audio_bus">
+ The name of the Area2D'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], overrides the default audio bus with the Area2D's. Defaults to [code]false[/code].
+ </member>
+ <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
+ The physics layer this Area2D 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 layers that object A scans.
+ </member>
+ <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
+ The physics layers this Area2D scans to determine collision detections.
+ </member>
+ <member name="gravity" type="float" setter="set_gravity" getter="get_gravity">
+ The gravity intensity within the Area2D (ranges -1024 to 1024). 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).
+ </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 this value is, the faster the strength of gravity decreases with the square of distance.
+ </member>
+ <member name="gravity_point" type="bool" setter="set_gravity_is_point" getter="is_gravity_a_point">
+ If [code]true[/code], calculates gravity from a particular point during a space override (see [method set_space_override_mode]). If a point, [Vector2] position is set with [method set_gravity_vector]. Defaults to [code]false[/code].
+ </member>
+ <member name="gravity_vec" type="Vector2" setter="set_gravity_vector" getter="get_gravity_vector">
+ The gravitational direction/strength as a vector (not normalized). If gravity is a point (see [method is_gravity_a_point]), this will be the attraction center.
+ </member>
+ <member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp">
+ The rate at which objects stop spinning in this area. Represents the amount of speed lost per second. If 1.0, physics bodies in the area stop rotating immediately. If 0.0, they never slow down. Does not incorporate external forces. The physics-update's rate affects 'angular_damp'.
+ </member>
+ <member name="monitorable" type="bool" setter="set_monitorable" getter="is_monitorable">
+ If [code]true[/code], other monitoring areas can detect this Area2D (is it undetectable at the moment?). Defaults to [code]true[/code].
+ </member>
+ <member name="monitoring" type="bool" setter="set_monitoring" getter="is_monitoring">
+ If [code]true[/code], this detects bodies/areas entering/exiting it (can it detect others at the moment?). Defaults to [code]true[/code].
+ </member>
+ <member name="priority" type="float" setter="set_priority" getter="get_priority">
+ The processing order for this priority. Ranges from 0 to 128. Defaults to 0. Higher priorities are processed first.
+ </member>
+ <member name="space_override" type="int" setter="set_space_override_mode" getter="get_space_override_mode" enum="Area2D.SpaceOverride">
+ How to override gravity and damping calculations within this Area2D, if at all. Consult the SPACE_OVERRIDE_* constants for available options.
+ </member>
+ </members>
+ <signals>
+ <signal name="area_entered">
+ <argument index="0" name="area" type="Object">
+ </argument>
+ <description>
+ This signal is triggered only once when an area enters this area. The only parameter passed is the area that entered this area.
+ </description>
+ </signal>
+ <signal name="area_exited">
+ <argument index="0" name="area" type="Object">
+ </argument>
+ <description>
+ This signal is triggered only once when an area exits this area. The only parameter passed is the area that exited this area.
+ </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>
+ This signal triggers only once when an area enters this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering.
+ </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>
+ This signal triggers only once when an area exits this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering.
+ </description>
+ </signal>
+ <signal name="body_entered">
+ <argument index="0" name="body" type="Object">
+ </argument>
+ <description>
+ This signal is triggered only once when a body enters this area. The only parameter passed is the body that entered this area.
+ </description>
+ </signal>
+ <signal name="body_exited">
+ <argument index="0" name="body" type="Object">
+ </argument>
+ <description>
+ This signal is triggered only once when a body exits this area. The only parameter passed is the body that exited this area.
+ </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>
+ This signal triggers only once when a body enters this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape of the body that entered this area, and the fourth one is the index of the shape in this area that reported the entering.
+ </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>
+ This signal triggers only once when a body exits this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape exiting this area, and the fourth one is the index of the shape in this area that reported the exit.
+ </description>
+ </signal>
+ </signals>
+ <constants>
+ <constant name="SPACE_OVERRIDE_DISABLED" value="0">
+ This area does not affect gravity/damp. These are areas that exist only to detect collisions and objects entering or exiting them.
+ </constant>
+ <constant name="SPACE_OVERRIDE_COMBINE" value="1">
+ 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.
+ </constant>
+ <constant name="SPACE_OVERRIDE_COMBINE_REPLACE" value="2">
+ 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.
+ </constant>
+ <constant name="SPACE_OVERRIDE_REPLACE" value="3">
+ This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas.
+ </constant>
+ <constant name="SPACE_OVERRIDE_REPLACE_COMBINE" value="4">
+ This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one.
+ </constant>
+ </constants>
+</class>