CharacterBody2D
A physics body for player-controlled characters with custom movement and collision response.
Physics/Movement
No shortcutIntermediate6 min readQuick Reference
CharacterBody2D
Godot EngineKeyboard Shortcut
N/A
Where to Find
Scene dock — Create New Node > Node2D > Physics
Best Used For
- ▸Control player character movement with code
- ▸Implement platformer physics with floor/wall detection
- ▸Handle collision response with custom logic
Intermediate⏱ 30–60 minutes to master
Key Settings
Add:Movement:Input:Floor detection:
CharacterBody2D gives you full control over character movement while providing collision detection. Uses move_and_slide() for automatic collision handling.
Where to Find It
Found under Node2D > Physics. Requires CollisionShape2D child.
How to Use
- Add: Add CharacterBody2D with CollisionShape2D child.
- Movement: Use
velocityandmove_and_slide()in_physics_process(delta). - Input: Use
Input.get_axis()to read player input. - Floor detection: Use
is_on_floor(),is_on_wall().
Pro Tips
- Set Motion Mode to Floating for top-down games.
- Use
floor_max_angleto control walkable slopes.