move_and_slide()
Default choice for platformers, top-down movement, slopes, and walls.
- Updates
is_on_floor()andis_on_wall() - Slides along surfaces automatically
- Works with the built-in
velocityproperty
Choose the right body type, collision layer, and movement API before tuning feel.
Map familiar Unity Rigidbody and trigger habits to Godot's body types, then practice the movement pattern that matches your game object.
Pick the body by ownership of motion first: you drive it, physics drives it, it blocks, or it only detects.
Think of this as "Rigidbody2D plus CharacterController behavior." You set velocity, then call move_and_slide().
move_and_slide()Default choice for platformers, top-down movement, slopes, and walls.
is_on_floor() and is_on_wall()velocity propertymove_and_collide()Use when you need custom collision response.
KinematicCollision2Dextends CharacterBody2D
@export var speed := 300.0
@export var jump_velocity := -420.0
var gravity: float = ProjectSettings.get_setting("physics/2d/default_gravity")
func _physics_process(delta: float) -> void:
if not is_on_floor():
velocity.y += gravity * delta
var direction := Input.get_axis("move_left", "move_right")
velocity.x = direction * speed
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = jump_velocity
move_and_slide()Create a CharacterBody2D with a CollisionShape2D and Sprite2D. Add Input Map actions for move_left, move_right, and jump, then test floor and wall behavior.
Before jumping to the next page, turn the idea into one tiny scene or script. That is where the Godot habit sticks.
Rigidbody habits do not map one-to-one to CharacterBody2D.
Character movement is less prebuilt, but more explicit and scriptable.
Use CharacterBody for controlled actors, RigidBody for simulation, Area for detection.
Build a collision layer chart for player, enemy, world, trigger, and pickup.