Attention: Here be dragons
This is thelatest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Area3D
Inherits:CollisionObject3D<Node3D<Node<Object
A region of 3D space that detects otherCollisionObject3Ds entering or exiting it.
Description
Area3D is a region of 3D space defined by one or multipleCollisionShape3D orCollisionPolygon3D child nodes. It detects when otherCollisionObject3Ds enter or exit it, and it also keeps track of which collision objects haven't exited it yet (i.e. which one are overlapping it).
This node can also locally alter or override physics parameters (gravity, damping) and route audio to custom audio buses.
Note: Areas and bodies created withPhysicsServer3D might not interact as expected withArea3Ds, and might not emit signals or track objects correctly.
Warning: Using aConcavePolygonShape3D inside aCollisionShape3D child of this node (created e.g. by using theCreate Trimesh Collision Sibling option in theMesh menu that appears when selecting aMeshInstance3D node) may give unexpected results, since this collision shape is hollow. If this is not desired, it has to be split into multipleConvexPolygonShape3Ds or primitive shapes likeBoxShape3D, or in some cases it may be replaceable by aCollisionPolygon3D.
Tutorials
Properties
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
|
Methods
overlaps_area(area:Node)const | |
overlaps_body(body:Node)const |
Signals
Emitted when the receivedarea enters this area. Requiresmonitoring to be set totrue.
Emitted when the receivedarea exits this area. Requiresmonitoring to be set totrue.
area_shape_entered(area_rid:RID, area:Area3D, area_shape_index:int, local_shape_index:int)🔗
Emitted when aShape3D of the receivedarea enters a shape of this area. Requiresmonitoring to be set totrue.
local_shape_index andarea_shape_index contain indices of the interacting shapes from this area and the other area, respectively.area_rid contains theRID of the other area. These values can be used with thePhysicsServer3D.
Example: Get theCollisionShape3D node from the shape index:
varother_shape_owner=area.shape_find_owner(area_shape_index)varother_shape_node=area.shape_owner_get_owner(other_shape_owner)varlocal_shape_owner=shape_find_owner(local_shape_index)varlocal_shape_node=shape_owner_get_owner(local_shape_owner)
area_shape_exited(area_rid:RID, area:Area3D, area_shape_index:int, local_shape_index:int)🔗
Emitted when aShape3D of the receivedarea exits a shape of this area. Requiresmonitoring to be set totrue.
See alsoarea_shape_entered.
Emitted when the receivedbody enters this area.body can be aPhysicsBody3D or aGridMap.GridMaps are detected if theirMeshLibrary has collision shapes configured. Requiresmonitoring to be set totrue.
Emitted when the receivedbody exits this area.body can be aPhysicsBody3D or aGridMap.GridMaps are detected if theirMeshLibrary has collision shapes configured. Requiresmonitoring to be set totrue.
body_shape_entered(body_rid:RID, body:Node3D, body_shape_index:int, local_shape_index:int)🔗
Emitted when aShape3D of the receivedbody enters a shape of this area.body can be aPhysicsBody3D or aGridMap.GridMaps are detected if theirMeshLibrary has collision shapes configured. Requiresmonitoring to be set totrue.
local_shape_index andbody_shape_index contain indices of the interacting shapes from this area and the interacting body, respectively.body_rid contains theRID of the body. These values can be used with thePhysicsServer3D.
Example: Get theCollisionShape3D node from the shape index:
varbody_shape_owner=body.shape_find_owner(body_shape_index)varbody_shape_node=body.shape_owner_get_owner(body_shape_owner)varlocal_shape_owner=shape_find_owner(local_shape_index)varlocal_shape_node=shape_owner_get_owner(local_shape_owner)
body_shape_exited(body_rid:RID, body:Node3D, body_shape_index:int, local_shape_index:int)🔗
Emitted when aShape3D of the receivedbody exits a shape of this area.body can be aPhysicsBody3D or aGridMap.GridMaps are detected if theirMeshLibrary has collision shapes configured. Requiresmonitoring to be set totrue.
See alsobody_shape_entered.
Enumerations
enumSpaceOverride:🔗
SpaceOverrideSPACE_OVERRIDE_DISABLED =0
This area does not affect gravity/damping.
SpaceOverrideSPACE_OVERRIDE_COMBINE =1
This area adds its gravity/damping values to whatever has been calculated so far (inpriority order).
SpaceOverrideSPACE_OVERRIDE_COMBINE_REPLACE =2
This area adds its gravity/damping values to whatever has been calculated so far (inpriority order), ignoring any lower priority areas.
SpaceOverrideSPACE_OVERRIDE_REPLACE =3
This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas.
SpaceOverrideSPACE_OVERRIDE_REPLACE_COMBINE =4
This area replaces any gravity/damping calculated so far (inpriority order), but keeps calculating the rest of the areas.
Property Descriptions
floatget_angular_damp()
The rate at which objects stop spinning in this area. Represents the angular velocity lost per second.
SeeProjectSettings.physics/3d/default_angular_damp for more details about damping.
SpaceOverrideangular_damp_space_override =0🔗
voidset_angular_damp_space_override_mode(value:SpaceOverride)
SpaceOverrideget_angular_damp_space_override_mode()
Override mode for angular damping calculations within this area.
StringNameaudio_bus_name =&"Master"🔗
StringNameget_audio_bus_name()
The name of the area's audio bus.
boolaudio_bus_override =false🔗
boolis_overriding_audio_bus()
Iftrue, the area's audio bus overrides the default audio bus.
floatget_gravity()
The area's gravity intensity (in meters per second squared). This value multiplies the gravity direction. This is useful to alter the force of gravity without altering its direction.
Vector3gravity_direction =Vector3(0,-1,0)🔗
Vector3get_gravity_direction()
The area's gravity vector (not normalized).
boolis_gravity_a_point()
Iftrue, gravity is calculated from a point (set viagravity_point_center). See alsogravity_space_override.
Vector3gravity_point_center =Vector3(0,-1,0)🔗
Vector3get_gravity_point_center()
If gravity is a point (seegravity_point), this will be the point of attraction.
floatgravity_point_unit_distance =0.0🔗
floatget_gravity_point_unit_distance()
The distance at which the gravity strength is equal togravity. For example, on a planet 100 meters in radius with a surface gravity of 4.0 m/s², set thegravity to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 meters from the center the gravity will be 1.0 m/s² (twice the distance, 1/4th the gravity), at 50 meters it will be 16.0 m/s² (half the distance, 4x the gravity), and so on.
The above is true only when the unit distance is a positive number. When this is set to 0.0, the gravity will be constant regardless of distance.
SpaceOverridegravity_space_override =0🔗
SpaceOverrideget_gravity_space_override_mode()
Override mode for gravity calculations within this area.
floatget_linear_damp()
The rate at which objects stop moving in this area. Represents the linear velocity lost per second.
SeeProjectSettings.physics/3d/default_linear_damp for more details about damping.
SpaceOverridelinear_damp_space_override =0🔗
voidset_linear_damp_space_override_mode(value:SpaceOverride)
SpaceOverrideget_linear_damp_space_override_mode()
Override mode for linear damping calculations within this area.
boolis_monitorable()
Iftrue, other monitoring areas can detect this area.
boolis_monitoring()
Iftrue, the area detects bodies or areas entering and exiting it.
intget_priority()
The area's priority. Higher priority areas are processed first. TheWorld3D's physics is always processed last, after all areas.
floatget_reverb_amount()
The degree to which this area applies reverb to its associated audio. Ranges from0 to1 with0.1 precision.
boolreverb_bus_enabled =false🔗
boolis_using_reverb_bus()
Iftrue, the area applies reverb to its associated audio.
StringNamereverb_bus_name =&"Master"🔗
StringNameget_reverb_bus_name()
The name of the reverb bus to use for this area's associated audio.
floatreverb_bus_uniformity =0.0🔗
floatget_reverb_uniformity()
The degree to which this area's reverb is a uniform effect. Ranges from0 to1 with0.1 precision.
floatwind_attenuation_factor =0.0🔗
floatget_wind_attenuation_factor()
The exponential rate at which wind force decreases with distance from its origin.
Note: This wind force only applies toSoftBody3D nodes. Other physics bodies are currently not affected by wind.
floatwind_force_magnitude =0.0🔗
floatget_wind_force_magnitude()
The magnitude of area-specific wind force.
Note: This wind force only applies toSoftBody3D nodes. Other physics bodies are currently not affected by wind.
NodePathwind_source_path =NodePath("")🔗
NodePathget_wind_source_path()
TheNode3D which is used to specify the direction and origin of an area-specific wind force. The direction is opposite to the z-axis of theNode3D's local transform, and its origin is the origin of theNode3D's local transform.
Note: This wind force only applies toSoftBody3D nodes. Other physics bodies are currently not affected by wind.
Method Descriptions
Array[Area3D]get_overlapping_areas()const🔗
Returns a list of intersectingArea3Ds. The overlapping area'sCollisionObject3D.collision_layer must be part of this area'sCollisionObject3D.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.
Array[Node3D]get_overlapping_bodies()const🔗
Returns a list of intersectingPhysicsBody3Ds andGridMaps. The overlapping body'sCollisionObject3D.collision_layer must be part of this area'sCollisionObject3D.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.
boolhas_overlapping_areas()const🔗
Returnstrue if intersecting anyArea3Ds, otherwise returnsfalse. The overlapping area'sCollisionObject3D.collision_layer must be part of this area'sCollisionObject3D.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.
boolhas_overlapping_bodies()const🔗
Returnstrue if intersecting anyPhysicsBody3Ds orGridMaps, otherwise returnsfalse. The overlapping body'sCollisionObject3D.collision_layer must be part of this area'sCollisionObject3D.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.
booloverlaps_area(area:Node)const🔗
Returnstrue if the givenArea3D intersects or overlaps thisArea3D,false otherwise.
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.
booloverlaps_body(body:Node)const🔗
Returnstrue if the given physics body intersects or overlaps thisArea3D,false otherwise.
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.
Thebody argument can either be aPhysicsBody3D or aGridMap instance. While GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body.