summaryrefslogtreecommitdiff
path: root/doc/classes/Area3D.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Area3D.xml')
-rw-r--r--doc/classes/Area3D.xml84
1 files changed, 52 insertions, 32 deletions
diff --git a/doc/classes/Area3D.xml b/doc/classes/Area3D.xml
index 3c50a1ac05..8923ac8aae 100644
--- a/doc/classes/Area3D.xml
+++ b/doc/classes/Area3D.xml
@@ -5,6 +5,8 @@
</brief_description>
<description>
3D area that detects [CollisionObject3D] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping) and route audio to custom audio buses.
+ To give the area its shape, add a [CollisionShape3D] or a [CollisionPolygon3D] node as a [i]direct[/i] child (or add multiple such nodes as direct children) of the area.
+ [b]Warning:[/b] See [ConcavePolygonShape3D] (also called "trimesh") for a warning about possibly unexpected behavior when using that shape for an area.
</description>
<tutorials>
<link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/125</link>
@@ -21,10 +23,24 @@
<method name="get_overlapping_bodies" qualifiers="const">
<return type="Node3D[]" />
<description>
- Returns a list of intersecting [PhysicsBody3D]s. The overlapping body's [member CollisionObject3D.collision_layer] must be part of this area's [member CollisionObject3D.collision_mask] in order to be detected.
+ Returns a list of intersecting [PhysicsBody3D]s and [GridMap]s. The overlapping body's [member CollisionObject3D.collision_layer] must be part of this area's [member CollisionObject3D.collision_mask] in order to be detected.
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.
</description>
</method>
+ <method name="has_overlapping_areas" qualifiers="const">
+ <return type="bool" />
+ <description>
+ Returns [code]true[/code] if intersecting any [Area3D]s, otherwise returns [code]false[/code]. The overlapping area's [member CollisionObject3D.collision_layer] must be part of this area's [member CollisionObject3D.collision_mask] in order to be detected.
+ For performance reasons (collisions are all processed at the same time) the list of overlapping areas is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
+ </description>
+ </method>
+ <method name="has_overlapping_bodies" qualifiers="const">
+ <return type="bool" />
+ <description>
+ Returns [code]true[/code] if intersecting any [PhysicsBody3D]s or [GridMap]s, otherwise returns [code]false[/code]. The overlapping body's [member CollisionObject3D.collision_layer] must be part of this area's [member CollisionObject3D.collision_mask] in order to be detected.
+ For performance reasons (collisions are all processed at the same time) the list of overlapping bodies is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
+ </description>
+ </method>
<method name="overlaps_area" qualifiers="const">
<return type="bool" />
<param index="0" name="area" type="Node" />
@@ -94,11 +110,11 @@
<member name="reverb_bus_amount" type="float" setter="set_reverb_amount" getter="get_reverb_amount" default="0.0">
The degree to which this area applies reverb to its associated audio. Ranges from [code]0[/code] to [code]1[/code] with [code]0.1[/code] precision.
</member>
- <member name="reverb_bus_enable" type="bool" setter="set_use_reverb_bus" getter="is_using_reverb_bus" default="false">
+ <member name="reverb_bus_enabled" type="bool" setter="set_use_reverb_bus" getter="is_using_reverb_bus" default="false">
If [code]true[/code], the area applies reverb to its associated audio.
</member>
- <member name="reverb_bus_name" type="StringName" setter="set_reverb_bus" getter="get_reverb_bus" default="&amp;&quot;Master&quot;">
- The reverb bus name to use for this area's associated audio.
+ <member name="reverb_bus_name" type="StringName" setter="set_reverb_bus_name" getter="get_reverb_bus_name" default="&amp;&quot;Master&quot;">
+ The name of the reverb bus to use for this area's associated audio.
</member>
<member name="reverb_bus_uniformity" type="float" setter="set_reverb_uniformity" getter="get_reverb_uniformity" default="0.0">
The degree to which this area's reverb is a uniform effect. Ranges from [code]0[/code] to [code]1[/code] with [code]0.1[/code] precision.
@@ -117,15 +133,13 @@
<signal name="area_entered">
<param index="0" name="area" type="Area3D" />
<description>
- Emitted when another Area3D enters this Area3D. Requires [member monitoring] to be set to [code]true[/code].
- [param area] the other Area3D.
+ Emitted when the received [param area] enters this area. Requires [member monitoring] to be set to [code]true[/code].
</description>
</signal>
<signal name="area_exited">
<param index="0" name="area" type="Area3D" />
<description>
- Emitted when another Area3D exits this Area3D. Requires [member monitoring] to be set to [code]true[/code].
- [param area] the other Area3D.
+ Emitted when the received [param area] exits this area. Requires [member monitoring] to be set to [code]true[/code].
</description>
</signal>
<signal name="area_shape_entered">
@@ -134,11 +148,18 @@
<param index="2" name="area_shape_index" type="int" />
<param index="3" name="local_shape_index" type="int" />
<description>
- Emitted when one of another Area3D's [Shape3D]s enters one of this Area3D's [Shape3D]s. Requires [member monitoring] to be set to [code]true[/code].
- [param area_rid] the [RID] of the other Area3D's [CollisionObject3D] used by the [PhysicsServer3D].
- [param area] the other Area3D.
- [param area_shape_index] the index of the [Shape3D] of the other Area3D used by the [PhysicsServer3D]. Get the [CollisionShape3D] node with [code]area.shape_owner_get_owner(area.shape_find_owner(area_shape_index))[/code].
- [param local_shape_index] the index of the [Shape3D] of this Area3D used by the [PhysicsServer3D]. Get the [CollisionShape3D] node with [code]self.shape_owner_get_owner(self.shape_find_owner(local_shape_index))[/code].
+ Emitted when a [Shape3D] of the received [param area] enters a shape of this area. Requires [member monitoring] to be set to [code]true[/code].
+ [param local_shape_index] and [param area_shape_index] contain indices of the interacting shapes from this area and the other area, respectively. [param area_rid] contains the [RID] of the other area. These values can be used with the [PhysicsServer3D].
+ [b]Example of getting the[/b] [CollisionShape3D] [b]node from the shape index:[/b]
+ [codeblocks]
+ [gdscript]
+ var other_shape_owner = area.shape_find_owner(area_shape_index)
+ var other_shape_node = area.shape_owner_get_owner(other_shape_owner)
+
+ var local_shape_owner = shape_find_owner(local_shape_index)
+ var local_shape_node = shape_owner_get_owner(local_shape_owner)
+ [/gdscript]
+ [/codeblocks]
</description>
</signal>
<signal name="area_shape_exited">
@@ -147,25 +168,20 @@
<param index="2" name="area_shape_index" type="int" />
<param index="3" name="local_shape_index" type="int" />
<description>
- Emitted when one of another Area3D's [Shape3D]s exits one of this Area3D's [Shape3D]s. Requires [member monitoring] to be set to [code]true[/code].
- [param area_rid] the [RID] of the other Area3D's [CollisionObject3D] used by the [PhysicsServer3D].
- [param area] the other Area3D.
- [param area_shape_index] the index of the [Shape3D] of the other Area3D used by the [PhysicsServer3D]. Get the [CollisionShape3D] node with [code]area.shape_owner_get_owner(area.shape_find_owner(area_shape_index))[/code].
- [param local_shape_index] the index of the [Shape3D] of this Area3D used by the [PhysicsServer3D]. Get the [CollisionShape3D] node with [code]self.shape_owner_get_owner(self.shape_find_owner(local_shape_index))[/code].
+ Emitted when a [Shape3D] of the received [param area] exits a shape of this area. Requires [member monitoring] to be set to [code]true[/code].
+ See also [signal area_shape_entered].
</description>
</signal>
<signal name="body_entered">
<param index="0" name="body" type="Node3D" />
<description>
- Emitted when a [PhysicsBody3D] or [GridMap] enters this Area3D. Requires [member monitoring] to be set to [code]true[/code]. [GridMap]s are detected if the [MeshLibrary] has Collision [Shape3D]s.
- [param body] the [Node], if it exists in the tree, of the other [PhysicsBody3D] or [GridMap].
+ Emitted when the received [param body] enters this area. [param body] can be a [PhysicsBody3D] or a [GridMap]. [GridMap]s are detected if their [MeshLibrary] has collision shapes configured. Requires [member monitoring] to be set to [code]true[/code].
</description>
</signal>
<signal name="body_exited">
<param index="0" name="body" type="Node3D" />
<description>
- Emitted when a [PhysicsBody3D] or [GridMap] exits this Area3D. Requires [member monitoring] to be set to [code]true[/code]. [GridMap]s are detected if the [MeshLibrary] has Collision [Shape3D]s.
- [param body] the [Node], if it exists in the tree, of the other [PhysicsBody3D] or [GridMap].
+ Emitted when the received [param body] exits this area. [param body] can be a [PhysicsBody3D] or a [GridMap]. [GridMap]s are detected if their [MeshLibrary] has collision shapes configured. Requires [member monitoring] to be set to [code]true[/code].
</description>
</signal>
<signal name="body_shape_entered">
@@ -174,11 +190,18 @@
<param index="2" name="body_shape_index" type="int" />
<param index="3" name="local_shape_index" type="int" />
<description>
- Emitted when one of a [PhysicsBody3D] or [GridMap]'s [Shape3D]s enters one of this Area3D's [Shape3D]s. Requires [member monitoring] to be set to [code]true[/code]. [GridMap]s are detected if the [MeshLibrary] has Collision [Shape3D]s.
- [param body_rid] the [RID] of the [PhysicsBody3D] or [MeshLibrary]'s [CollisionObject3D] used by the [PhysicsServer3D].
- [param body] the [Node], if it exists in the tree, of the [PhysicsBody3D] or [GridMap].
- [param body_shape_index] the index of the [Shape3D] of the [PhysicsBody3D] or [GridMap] used by the [PhysicsServer3D]. Get the [CollisionShape3D] node with [code]body.shape_owner_get_owner(body.shape_find_owner(body_shape_index))[/code].
- [param local_shape_index] the index of the [Shape3D] of this Area3D used by the [PhysicsServer3D]. Get the [CollisionShape3D] node with [code]self.shape_owner_get_owner(self.shape_find_owner(local_shape_index))[/code].
+ Emitted when a [Shape3D] of the received [param body] enters a shape of this area. [param body] can be a [PhysicsBody3D] or a [GridMap]. [GridMap]s are detected if their [MeshLibrary] has collision shapes configured. Requires [member monitoring] to be set to [code]true[/code].
+ [param local_shape_index] and [param body_shape_index] contain indices of the interacting shapes from this area and the interacting body, respectively. [param body_rid] contains the [RID] of the body. These values can be used with the [PhysicsServer3D].
+ [b]Example of getting the[/b] [CollisionShape3D] [b]node from the shape index:[/b]
+ [codeblocks]
+ [gdscript]
+ var body_shape_owner = body.shape_find_owner(body_shape_index)
+ var body_shape_node = body.shape_owner_get_owner(body_shape_owner)
+
+ var local_shape_owner = shape_find_owner(local_shape_index)
+ var local_shape_node = shape_owner_get_owner(local_shape_owner)
+ [/gdscript]
+ [/codeblocks]
</description>
</signal>
<signal name="body_shape_exited">
@@ -187,11 +210,8 @@
<param index="2" name="body_shape_index" type="int" />
<param index="3" name="local_shape_index" type="int" />
<description>
- Emitted when one of a [PhysicsBody3D] or [GridMap]'s [Shape3D]s enters one of this Area3D's [Shape3D]s. Requires [member monitoring] to be set to [code]true[/code]. [GridMap]s are detected if the [MeshLibrary] has Collision [Shape3D]s.
- [param body_rid] the [RID] of the [PhysicsBody3D] or [MeshLibrary]'s [CollisionObject3D] used by the [PhysicsServer3D].
- [param body] the [Node], if it exists in the tree, of the [PhysicsBody3D] or [GridMap].
- [param body_shape_index] the index of the [Shape3D] of the [PhysicsBody3D] or [GridMap] used by the [PhysicsServer3D]. Get the [CollisionShape3D] node with [code]body.shape_owner_get_owner(body.shape_find_owner(body_shape_index))[/code].
- [param local_shape_index] the index of the [Shape3D] of this Area3D used by the [PhysicsServer3D]. Get the [CollisionShape3D] node with [code]self.shape_owner_get_owner(self.shape_find_owner(local_shape_index))[/code].
+ Emitted when a [Shape3D] of the received [param body] exits a shape of this area. [param body] can be a [PhysicsBody3D] or a [GridMap]. [GridMap]s are detected if their [MeshLibrary] has collision shapes configured. Requires [member monitoring] to be set to [code]true[/code].
+ See also [signal body_shape_entered].
</description>
</signal>
</signals>