Kraken Logo

Kraken Engine

DocumentationGuidesShowcaseCommunity
Ctrl
K
Navigating the Docs
Building Docs
Overview
Anchor
AnimationController
Audio
Batcher
Body
Camera
Capsule
CastHit
CharacterBody
Circle
Collision
Color
DistanceJoint
Effect
Event
FilterJoint
Flip (Texture)
Font
ImageLayer
InputAction
Joint
Layer
Line
Map
MapObject
Mask
MotorJoint
MouseJoint
ObjectGroup
Orchestrator
PixelArray
PolarCoordinate
Polygon
PrismaticJoint
Rect
RevoluteJoint
RigidBody
Sample
Sampler
Shader
SheetStrip
StaticBody
Stream
Style
Terrain (TileSet)
Text
TextProperties
Texture
Tile (TileLayer)
Tile (TileSet)
TileLayer
TileResult (TileLayer)
TileSet
Timer
Transform
Tween
Vec2
Vertex
WeldJoint
WheelJoint
World

Built bydurkisneer1.Kraken Engine is open source and available onGitHub.

  1. Docs
  2. Classes
  3. Character Body

CharacterBody

A kinematic physics body designed for player-controlled characters. Access via the 'physics' submodule.

Experimental API:

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

Inherits from Body.

Constructor

  • CharacterBody(world: World) → CharacterBodyCharacterBody(world: World) → CharacterBody

A kinematic physics body designed for player-controlled characters.

Properties


NameDescriptionType
motion_modeThe motion mode of the character.CharacterBody.MotionMode
velocityThe velocity of the character body.Vec2
massThe simulated mass of the character for pushing rigid bodies.float
max_speedThe maximum speed the character can move.float
accelerationThe acceleration applied when moving.float
frictionThe friction applied when on the ground.float
stop_speedThe speed threshold below which the character will stop moving.float
air_steerThe control factor for steering while in the air (0.0 to 1.0).float
capsule_shapeThe capsule shape used for ground detection and collision casting.Capsule

Methods


Move And Slide

move_and_slide(delta: float = -1.0) → Nonemove_and_slide(delta: float = -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.

Is On Floor

is_on_floor() → boolis_on_floor() → bool

Check if the character is currently in contact with the floor.

Returns

bool : True if the character is on the floor, False otherwise.

Is On Ceiling

is_on_ceiling() → boolis_on_ceiling() → bool

Check if the character is currently in contact with the ceiling.

Returns

bool : True if the character is on the ceiling, False otherwise.

Is On Wall

is_on_wall() → boolis_on_wall() → bool

Check if the character is currently in contact with a wall.

Returns

bool : True if the character is on a wall, False otherwise.

PreviousCastHit
NextCircle

On this page

ConstructorPropertiesMethodsMove And SlideIs On FloorIs On CeilingIs On Wall