Signal5
Signal support.
Area2D.swift:1507class Signal5
Use the connect(flags:_:)
method to connect to the signal on the container object, and disconnect(_:)
to drop the connection.
You can also await the emitted
property for waiting for a single emission of the signal.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (38) members.
Types
class Signal1
Signal support.
class Signal2
Signal support.
class Signal3
Signal support.
class Signal4
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: Area2D.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
Shape2D
of the receivedarea
enters a shape of this area. Requiresmonitoring
to be set totrue
.var areaShapeExited: Signal6
Emitted when a
Shape2D
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 aPhysicsBody2D
or aTileMap
.TileMap
s are detected if theirTileSet
has collision shapes configured. Requiresmonitoring
to be set totrue
.var bodyExited: Signal4
Emitted when the received
body
exits this area.body
can be aPhysicsBody2D
or aTileMap
.TileMap
s are detected if theirTileSet
has collision shapes configured. Requiresmonitoring
to be set totrue
.var bodyShapeEntered: Signal1
Emitted when a
Shape2D
of the receivedbody
enters a shape of this area.body
can be aPhysicsBody2D
or aTileMap
.TileMap
s are detected if theirTileSet
has collision shapes configured. Requiresmonitoring
to be set totrue
.var bodyShapeExited: Signal2
Emitted when a
Shape2D
of the receivedbody
exits a shape of this area.body
can be aPhysicsBody2D
or aTileMap
.TileMap
s are detected if theirTileSet
has collision shapes configured. Requiresmonitoring
to be set totrue
.var gravity: Double
The area’s gravity intensity (in pixels per second squared). This value multiplies the gravity direction. This is useful to alter the force of gravity without altering its direction.
var gravityDirection: Vector2
The area’s gravity vector (not normalized).
var gravityPoint: Bool
If
true
, gravity is calculated from a point (set viagravityPointCenter
). See alsogravitySpaceOverride
.var gravityPointCenter: Vector2
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 pixels in radius with a surface gravity of 4.0 px/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 pixels from the center the gravity will be 1.0 px/s² (twice the distance, 1/4th the gravity), at 50 pixels it will be 16.0 px/s² (half the distance, 4x the gravity), and so on.var gravitySpaceOverride: Area2D.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: Area2D.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
World2D
’s physics is always processed last, after all areas.func getOverlappingAreas(
) -> ObjectCollection<Area2D> Returns a list of intersecting
Area2D
s. The overlapping area’scollisionLayer
must be part of this area’scollisionMask
in order to be detected.func getOverlappingBodies(
) -> ObjectCollection<Node2D> Returns a list of intersecting
PhysicsBody2D
s andTileMap
s. The overlapping body’scollisionLayer
must be part of this area’scollisionMask
in order to be detected.func hasOverlappingAreas(
) -> Bool Returns
true
if intersecting anyArea2D
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 anyPhysicsBody2D
s orTileMap
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 givenArea2D
intersects or overlaps thisArea2D
,false
otherwise.func overlapsBody(Node?
) -> Bool Returns
true
if the given physics body intersects or overlaps thisArea2D
,false
otherwise.
Citizens in SwiftGodot
Instance members
var emitted: Void
You can await this property to wait for the signal to be emitted once
func connect(flags: Object.ConnectFlags, @escaping (_ areaRid: RID, _ area: Area2D, _ areaShapeIndex: Int64, _ localShapeIndex: Int64) -> ()
) -> Object Connects the signal to the specified callback
func disconnect(Object
) Disconnects a signal that was previously connected, the return value from calling
connect(flags:_:)