CharacterBody

API reference for CharacterBody. Access via the 'physics' submodule.

Experimental API:

The physics submodule is a VERY experimental and new API that is highly susceptible to breaking changes in the future.

Inherits from Body.

Constructor

Properties


NameDescriptionType
floor_max_angleMaximum angle (in radians) to consider a surface as a floor. Default is ~45 degrees.float
floor_snap_distanceDistance in pixels to probe downward for floor detection. Default is 5.0.float
massThe mass of the character body. Default is 80.0.float
velocityThe velocity of the character body.Vec2

Methods


Is On Ceiling

is_on_ceiling() bool

Whether the character is currently touching a ceiling.

Is On Floor

is_on_floor() bool

Whether the character is currently on a floor surface.

Is On Wall

is_on_wall() bool

Whether the character is currently touching a wall.

Move And Slide

move_and_slide(delta: SupportsFloat = -1.0) None

Perform movement and collision resolution for the character.

This method moves the character according to the velocity property and resolves collisions by sliding along surfaces. It also updates the floor/ceiling/wall contact states.

Args

  • delta : The time step to use for movement. Defaults to -1.0, which uses the frame delta.