Area2D

2D area for detection and 2D physics influence.

2D area that detects CollisionObject2D nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping).

@GodotBaseClass
struct Area2D {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Enums

Constants
enum Constants
SpaceOverride
enum SpaceOverride

Functions

_areaEnterTree
void _areaEnterTree(long id)
_areaExitTree
void _areaExitTree(long id)
_areaInout
void _areaInout(long arg0, RID arg1, long arg2, long arg3, long arg4)
_bodyEnterTree
void _bodyEnterTree(long id)
_bodyExitTree
void _bodyExitTree(long id)
_bodyInout
void _bodyInout(long arg0, RID arg1, long arg2, long arg3, long arg4)
getAngularDamp
double getAngularDamp()
getAudioBusName
String getAudioBusName()
getCollisionLayer
long getCollisionLayer()
getCollisionLayerBit
bool getCollisionLayerBit(long bit)

Returns an individual bit on the layer mask. Describes whether other areas will collide with this one on the given layer.

getCollisionMask
long getCollisionMask()
getCollisionMaskBit
bool getCollisionMaskBit(long bit)

Returns an individual bit on the collision mask. Describes whether this area will collide with others on the given layer.

getGravity
double getGravity()
getGravityDistanceScale
double getGravityDistanceScale()
getGravityVector
Vector2 getGravityVector()
getLinearDamp
double getLinearDamp()
getOverlappingAreas
Array getOverlappingAreas()

Returns a list of intersecting Area2Ds. 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.

getOverlappingBodies
Array getOverlappingBodies()

Returns a list of intersecting PhysicsBody2Ds. 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.

getPriority
double getPriority()
getSpaceOverrideMode
Area2D.SpaceOverride getSpaceOverrideMode()
isGravityAPoint
bool isGravityAPoint()
isMonitorable
bool isMonitorable()
isMonitoring
bool isMonitoring()
isOverridingAudioBus
bool isOverridingAudioBus()
opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(Area2D other)
opEquals
bool opEquals(typeof(null) n)
overlapsArea
bool overlapsArea(Node area)

If true, the given area overlaps the Area2D. Note: The result of this test is not immediate after moving objects. For performance, the list of overlaps is updated once per frame and before the physics step. Consider using signals instead.

overlapsBody
bool overlapsBody(Node _body)

If true, the given physics body overlaps the Area2D. 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. The body argument can either be a PhysicsBody2D or a TileMap instance (while TileMaps are not physics bodies themselves, they register their tiles with collision shapes as a virtual physics body).

setAngularDamp
void setAngularDamp(double angular_damp)
setAudioBusName
void setAudioBusName(String name)
setAudioBusOverride
void setAudioBusOverride(bool enable)
setCollisionLayer
void setCollisionLayer(long collision_layer)
setCollisionLayerBit
void setCollisionLayerBit(long bit, bool value)

Set/clear individual bits on the layer mask. This makes getting an area in/out of only one layer easier.

setCollisionMask
void setCollisionMask(long collision_mask)
setCollisionMaskBit
void setCollisionMaskBit(long bit, bool value)

Set/clear individual bits on the collision mask. This makes selecting the areas scanned easier.

setGravity
void setGravity(double gravity)
setGravityDistanceScale
void setGravityDistanceScale(double distance_scale)
setGravityIsPoint
void setGravityIsPoint(bool enable)
setGravityVector
void setGravityVector(Vector2 vector)
setLinearDamp
void setLinearDamp(double linear_damp)
setMonitorable
void setMonitorable(bool enable)
setMonitoring
void setMonitoring(bool enable)
setPriority
void setPriority(double priority)
setSpaceOverrideMode
void setSpaceOverrideMode(long space_override_mode)
toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

angularDamp
double angularDamp [@property getter]
double angularDamp [@property setter]

The rate at which objects stop spinning in this area. Represents the angular velocity lost per second. See ProjectSettings.physics/2d/defaultAngularDamp for more details about damping.

audioBusName
String audioBusName [@property getter]
String audioBusName [@property setter]

The name of the area's audio bus.

audioBusOverride
bool audioBusOverride [@property getter]
bool audioBusOverride [@property setter]

If true, the area's audio bus overrides the default audio bus.

collisionLayer
long collisionLayer [@property getter]
long collisionLayer [@property setter]

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 collisionMask. See url=https://docs.godotengine.org/en/3.3/tutorials/physics/physics_introduction.html#collision-layers-and-masksCollision layers and masks/url in the documentation for more information.

collisionMask
long collisionMask [@property getter]
long collisionMask [@property setter]

The physics layers this area scans to determine collision detection. See url=https://docs.godotengine.org/en/3.3/tutorials/physics/physics_introduction.html#collision-layers-and-masksCollision layers and masks/url in the documentation for more information.

gravity
double gravity [@property getter]
double gravity [@property setter]

The area's gravity intensity (in pixels per second squared). This value multiplies the gravity vector. This is useful to alter the force of gravity without altering its direction.

gravityDistanceScale
double gravityDistanceScale [@property getter]
double gravityDistanceScale [@property setter]

The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.

gravityPoint
bool gravityPoint [@property getter]
bool gravityPoint [@property setter]

If true, gravity is calculated from a point (set via gravityVec). See also spaceOverride.

gravityVec
Vector2 gravityVec [@property getter]
Vector2 gravityVec [@property setter]

The area's gravity vector (not normalized). If gravity is a point (see gravityPoint), this will be the point of attraction.

linearDamp
double linearDamp [@property getter]
double linearDamp [@property setter]

The rate at which objects stop moving in this area. Represents the linear velocity lost per second. See ProjectSettings.physics/2d/defaultLinearDamp for more details about damping.

monitorable
bool monitorable [@property getter]
bool monitorable [@property setter]

If true, other monitoring areas can detect this area.

monitoring
bool monitoring [@property getter]
bool monitoring [@property setter]

If true, the area detects bodies or areas entering and exiting it.

priority
double priority [@property getter]
double priority [@property setter]

The area's priority. Higher priority areas are processed first.

spaceOverride
Area2D.SpaceOverride spaceOverride [@property getter]
long spaceOverride [@property setter]

Override mode for gravity and damping calculations within this area. See spaceoverride for possible values.

Static functions

_new
Area2D _new()

Construct a new instance of Area2D. Note: use memnew!Area2D instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta