Area3D
A region of 3D space that detects other CollisionObject3D
s entering or exiting it.
class Area3D
Area3D
is a region of 3D space defined by one or multiple CollisionShape3D
or CollisionPolygon3D
child nodes. It detects when other CollisionObject3D
s 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.
This object emits the following signals:
Superclasses
class CollisionObject3D
Abstract base class for 3D physics objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
class Signal1
Signal support.
class Signal2
Signal support.
class Signal3
Signal support.
class Signal4
Signal support.
class Signal5
Signal support.
class Signal6
Signal support.
class Signal7
Signal support.
class Signal8
Signal support.
enum SpaceOverride
Type members
Instance members
var angularDamp: Double
The rate at which objects stop spinning in this area. Represents the angular velocity lost per second.
var angularDampSpaceOverride: Area3D.SpaceOverride
Override mode for angular damping calculations within this area. See
SpaceOverride
for possible values.var areaEntered: Signal7
Emitted when the received
area
enters this area. Requiresmonitoring
to be set totrue
.var areaExited: Signal8
Emitted when the received
area
exits this area. Requiresmonitoring
to be set totrue
.var areaShapeEntered: Signal5
Emitted when a
Shape3D
of the receivedarea
enters a shape of this area. Requiresmonitoring
to be set totrue
.var areaShapeExited: Signal6
Emitted when a
Shape3D
of the receivedarea
exits a shape of this area. Requiresmonitoring
to be set totrue
.var audioBusName: StringName
The name of the area’s audio bus.
var audioBusOverride: Bool
If
true
, the area’s audio bus overrides the default audio bus.var bodyEntered: Signal3
Emitted when the received
body
enters this area.body
can be aPhysicsBody3D
or aGridMap
.GridMap
s are detected if theirMeshLibrary
has collision shapes configured. Requiresmonitoring
to be set totrue
.var bodyExited: Signal4
Emitted when the received
body
exits this area.body
can be aPhysicsBody3D
or aGridMap
.GridMap
s are detected if theirMeshLibrary
has collision shapes configured. Requiresmonitoring
to be set totrue
.var bodyShapeEntered: Signal1
Emitted when a
Shape3D
of the receivedbody
enters a shape of this area.body
can be aPhysicsBody3D
or aGridMap
.GridMap
s are detected if theirMeshLibrary
has collision shapes configured. Requiresmonitoring
to be set totrue
.var bodyShapeExited: Signal2
Emitted when a
Shape3D
of the receivedbody
exits a shape of this area.body
can be aPhysicsBody3D
or aGridMap
.GridMap
s are detected if theirMeshLibrary
has collision shapes configured. Requiresmonitoring
to be set totrue
.var gravity: Double
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.
var gravityDirection: Vector3
The area’s gravity vector (not normalized).
var gravityPoint: Bool
If
true
, gravity is calculated from a point (set viagravityPointCenter
). See alsogravitySpaceOverride
.var gravityPointCenter: Vector3
If gravity is a point (see
gravityPoint
), this will be the point of attraction.var gravityPointUnitDistance: Double
The distance at which the gravity strength is equal to
gravity
. 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.var gravitySpaceOverride: Area3D.SpaceOverride
Override mode for gravity calculations within this area. See
SpaceOverride
for possible values.var linearDamp: Double
The rate at which objects stop moving in this area. Represents the linear velocity lost per second.
var linearDampSpaceOverride: Area3D.SpaceOverride
Override mode for linear damping calculations within this area. See
SpaceOverride
for possible values.var monitorable: Bool
If
true
, other monitoring areas can detect this area.var monitoring: Bool
If
true
, the area detects bodies or areas entering and exiting it.var priority: Int32
The area’s priority. Higher priority areas are processed first. The
World3D
’s physics is always processed last, after all areas.var reverbBusAmount: Double
The degree to which this area applies reverb to its associated audio. Ranges from
0
to1
with0.1
precision.var reverbBusEnabled: Bool
If
true
, the area applies reverb to its associated audio.var reverbBusName: StringName
The name of the reverb bus to use for this area’s associated audio.
var reverbBusUniformity: Double
The degree to which this area’s reverb is a uniform effect. Ranges from
0
to1
with0.1
precision.var windAttenuationFactor: Double
The exponential rate at which wind force decreases with distance from its origin.
var windForceMagnitude: Double
The magnitude of area-specific wind force.
var windSourcePath: NodePath
The
Node3D
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.func getOverlappingAreas(
) -> ObjectCollection<Area3D> Returns a list of intersecting
Area3D
s. The overlapping area’scollisionLayer
must be part of this area’scollisionMask
in order to be detected.func getOverlappingBodies(
) -> ObjectCollection<Node3D> Returns a list of intersecting
PhysicsBody3D
s andGridMap
s. The overlapping body’scollisionLayer
must be part of this area’scollisionMask
in order to be detected.func hasOverlappingAreas(
) -> Bool Returns
true
if intersecting anyArea3D
s, otherwise returnsfalse
. The overlapping area’scollisionLayer
must be part of this area’scollisionMask
in order to be detected.func hasOverlappingBodies(
) -> Bool Returns
true
if intersecting anyPhysicsBody3D
s orGridMap
s, otherwise returnsfalse
. The overlapping body’scollisionLayer
must be part of this area’scollisionMask
in order to be detected.func overlapsArea(Node?
) -> Bool Returns
true
if the givenArea3D
intersects or overlaps thisArea3D
,false
otherwise.func overlapsBody(Node?
) -> Bool Returns
true
if the given physics body intersects or overlaps thisArea3D
,false
otherwise.