Skip to content

Physics actions

7 actions in the Physics category. Each block mirrors how the action appears in the editor's sidebar.

Can See

Physics
Can See Physics
Node not set | Target not set | → Clear | → Blocked

Checks whether a straight line from this node to another node is free of obstacles. It is the usual way to give an enemy a line of sight.

Input Type Default Description
Node Node - The node that looks. Leave it empty to look from this node.
Target Node - The node to look at, such as the player. Point it at the body itself, since a parent above the collider never matches.
Branch Goes to
Clear Where to go when nothing stands between the two nodes.
Blocked Where to go when something is in the way.

Phases StartEvery FramePhysics Works on Node2DNode3D

Get Bodies In Radius

Physics
Get Bodies In Radius Physics
Node not set | Radius 100.0 | Mask 1 | → Any | → None

Asks the physics world which bodies sit inside a circle around this node and stores them as a list. Use it for a blast, a shockwave or a scan of what is near.

Input Type Default Description
Node Node - The node the circle is centered on. Leave it empty to center it on this node.
Radius float 100.0 How far around the node to look, in pixels in 2D and in meters in 3D.
Mask int 1 Which collision layers to look at, as the same number the inspector shows for a collision mask.
Output Type Description
Result Array The bodies found inside the circle, without this node.
Branch Goes to
Any Where to go when at least one body sits inside the radius.
None Where to go when the radius is clear, which is when an empty list is stored.

Phases StartEvery FramePhysics Works on Node2DNode3D

Get Overlapping Areas

Physics
Get Overlapping Areas Physics
not set | → Found | → None

Stores the other areas that overlap an Area2D or an Area3D right now, such as the 2 hurtboxes a sword swing is touching. It reads the list the area already keeps, while Get Bodies In Radius asks the physics world again.

Input Type Default Description
Area Node - The Area2D or Area3D to read, such as a hitbox or a pickup radius.
Output Type Description
Result Array Where to store the areas that overlap the area right now.
Branch Goes to
Found Where to go when at least one other area overlaps this one.
None Where to go when no other area overlaps this one, which is when an empty list is stored.

Phases StartEvery FramePhysics

Get Overlapping Bodies

Physics
Get Overlapping Bodies Physics
not set | → Found | → None

Stores the bodies that are inside an Area2D or an Area3D right now, such as the 3 enemies standing in a damage zone. It reads the list the area already keeps, while Get Bodies In Radius asks the physics world again.

Input Type Default Description
Area Node - The Area2D or Area3D to read, such as a hitbox or a pickup radius.
Output Type Description
Result Array Where to store the bodies that touch the area right now.
Branch Goes to
Found Where to go when at least one body is inside the area.
None Where to go when no body is inside the area, which is when an empty list is stored.

Phases StartEvery FramePhysics

Set Collision Bit

Every Frame
Set Collision Bit Physics
Target not set | Kind 'layer' | Bit 1 | On true

Switches one collision layer or mask bit of a body on or off. The layer says where the body lives, the mask says what it bumps into.

Input Type Default Description
Target Node - The body to change. Leave it empty to change this node.
Kind String 'layer' Which side to change.
Bit int 1 The bit to change, counting from 1 like the numbers in the inspector.
On bool true True to switch the bit on, false to switch it off.

Phases StartEvery FramePhysicsEnd

Set Collision Enabled

Every Frame
Set Collision Enabled Physics
Shape not set | Enabled true

Turns a collision shape on or off, so a body can stop colliding without leaving the scene. Good for a hitbox that only counts during an attack.

Input Type Default Description
Shape Node - The collision shape to turn on or off. Leave it empty to change this node.
Enabled bool true True to make the shape collide again, false to switch it off.

Phases StartEvery FramePhysicsEnd

Set Gravity Scale

Every Frame
Set Gravity Scale Physics
Node not set | Scale 1.0

Sets how strongly gravity pulls this body. 1 is normal gravity, 0 makes it float and a negative value makes it fall upwards.

Input Type Default Description
Node Node - The body to change. Leave it empty to change this node.
Scale float 1.0 How much gravity to apply, as a multiplier of the world gravity.

Phases StartEvery FramePhysicsEnd Works on RigidBody2DRigidBody3D