Kinematic vs Dynamic Characters
The player character is the object the player watches most closely, so it is the hardest one to get right. Physics engines offer two ways to build one:
- A dynamic character is an ordinary rigid body (usually a capsule with its rotation locked). You move it with forces or velocities, and the solver handles collisions, friction and gravity like it does for crates.
- A kinematic character is moved by your code. Each step you say "I want to move by this much", a collision query finds out how far that move can go, and you decide what happens at walls, slopes and steps. The solver never pushes it around.
Unity's CharacterController, Unreal's UCharacterMovementComponent, Godot's CharacterBody3D and Rapier's KinematicCharacterController are all kinematic controllers. That is not a coincidence.
Why most player characters are kinematic
| Dynamic (rigid body) | Kinematic (controller) | |
|---|---|---|
| Who decides the motion | the solver: forces, friction, restitution | your code: desired move + collision queries |
| Stopping when input is released | slides until friction stops it | stops on the exact step you choose |
| Walking up a step | gets stuck or launched, unless you add tricks | an explicit step-up rule |
| Standing on a slope | slowly slides down (friction is approximate) | stays put if the slope is walkable |
| Getting hit by a heavy object | gets shoved, spun or squashed into geometry | ignores it unless you add a reaction |
| Pushing crates | automatic (mass ratio decides) | you write the push yourself |
| Ragdoll, vehicles, "physicsy" games | natural fit | awkward |
Players read a character's responsiveness in milliseconds. A dynamic body adds latency (forces need several steps to change velocity), bounces off corners and keeps sliding after the player let go. All of that can be tuned away, but tuning a rigid body until it stops behaving like a rigid body is a lot of work. A kinematic controller starts from "do exactly what the input says" and adds physics-like behaviour (gravity, sliding on steep slopes, being pushed by platforms) only where the design wants it.
Dynamic characters still make sense where the physics is the game: a rolling ball, a ragdoll-heavy brawler, a wobbly physics comedy, a vehicle.
The same input, two characters
Here both characters run right for six steps, then the player releases the stick. The dynamic one accelerates with a force, decelerates with friction, and has a little restitution against the wall. The kinematic one moves at the input speed and stops exactly at the wall.
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
double z0(double v) { return std::fabs(v) < 5e-4 ? 0.0 : v; }
int main() {
std::cout << std::fixed << std::setprecision(3);
const double dt = 0.1, wallX = 3.0, radius = 0.5;
// dynamic body: accelerate with a force, friction when coasting, a bit of bounce
const double accel = 20.0, frictionDecel = 0.6 * 9.81, restitution = 0.3;
// kinematic controller: move at the input speed, clamp at the wall
const double speed = 4.0;
double dx = 0, dv = 0, kx = 0;
std::cout << "step input | dynamic x v | kinematic x\n";
for (int step = 1; step <= 12; step++) {
bool held = step <= 6;
dv += (held ? accel : 0) * dt;
if (!held) {
double dec = frictionDecel * dt;
dv = std::fabs(dv) <= dec ? 0 : dv - std::copysign(dec, dv);
}
dx += dv * dt;
if (dx + radius > wallX) { dx = wallX - radius; dv = -dv * restitution; }
double want = held ? speed * dt : 0;
kx = std::min(kx + want, wallX - radius);
std::cout << std::setw(4) << step << (held ? " right" : " - ") << " | "
<< std::setw(9) << dx << " " << std::setw(7) << z0(dv) << " | " << std::setw(9) << kx << "\n";
}
}step input | dynamic x v | kinematic x
1 right | 0.200 2.000 | 0.400
2 right | 0.600 4.000 | 0.800
3 right | 1.200 6.000 | 1.200
4 right | 2.000 8.000 | 1.600
5 right | 2.500 -3.000 | 2.000
6 right | 2.400 -1.000 | 2.400
7 - | 2.359 -0.411 | 2.400
8 - | 2.359 0.000 | 2.400
9 - | 2.359 0.000 | 2.400
10 - | 2.359 0.000 | 2.400
11 - | 2.359 0.000 | 2.400
12 - | 2.359 0.000 | 2.400
Read the dynamic column: it starts slowly (the force needs time), reaches the wall at 8 m/s, bounces back, and ends up somewhere the player never aimed for. The kinematic column is boring, which is exactly what a player wants: it moves at 4 m/s from the first step and stops where the input stopped. (It would also stop flush against the wall at x = 2.5 if the stick were held longer.)
Pushing rigid bodies from a kinematic controller
Since the solver doesn't move a kinematic character, it also doesn't let the character push anything. A kinematic body has "infinite mass" from the solver's point of view, so engines either ignore the contact or shove the crate with unlimited strength. Most games write the push themselves: when the controller's move hits a dynamic body, give that body a velocity or impulse along the move direction, scaled down for heavy objects.
#include <iostream>
#include <iomanip>
#include <algorithm>
// When the character walks into a crate, give the crate a velocity along the walk direction.
// Heavy crates move slower; anything above maxPushMass doesn't move at all.
double pushVelocity(double walkSpeed, double crateMass, double strength, double maxPushMass) {
if (crateMass > maxPushMass) return 0.0;
return std::min(walkSpeed, strength / crateMass);
}
int main() {
std::cout << std::fixed << std::setprecision(3);
const double walkSpeed = 3.0, strength = 60.0, maxPushMass = 150.0;
for (double mass : {5.0, 20.0, 40.0, 100.0, 300.0}) {
double v = pushVelocity(walkSpeed, mass, strength, maxPushMass);
double characterSpeed = std::min(walkSpeed, v > 0 ? v : 0.0); // walk no faster than the crate
std::cout << "crate " << std::setw(7) << mass << " kg: crate speed " << v
<< " m/s, character speed " << characterSpeed << " m/s\n";
}
}crate 5.000 kg: crate speed 3.000 m/s, character speed 3.000 m/s
crate 20.000 kg: crate speed 3.000 m/s, character speed 3.000 m/s
crate 40.000 kg: crate speed 1.500 m/s, character speed 1.500 m/s
crate 100.000 kg: crate speed 0.600 m/s, character speed 0.600 m/s
crate 300.000 kg: crate speed 0.000 m/s, character speed 0.000 m/s
Two details matter in practice: slow the character to the crate's speed (otherwise it walks into the crate every step and the crate jitters), and don't push objects you are standing on (check that the contact normal is mostly horizontal). In Unity this logic lives in OnControllerColliderHit:
// Unity 6: CharacterController pushing rigid bodies (not runnable here)
public float pushPower = 2f;
void OnControllerColliderHit(ControllerColliderHit hit)
{
Rigidbody body = hit.collider.attachedRigidbody;
if (body == null || body.isKinematic) return;
if (hit.moveDirection.y < -0.3f) return; // we are standing on it
Vector3 pushDir = new Vector3(hit.moveDirection.x, 0f, hit.moveDirection.z);
body.linearVelocity = pushDir * pushPower; // Unity 6 name (formerly velocity)
}In Godot, a CharacterBody3D reports its contacts after move_and_slide() through get_slide_collision_count() and get_slide_collision(i). If the collider is a RigidBody3D, call apply_central_impulse() on it with a push along -collision.get_normal().
Moving platforms and being pushed
The other direction, the world pushing the character, also needs code. Common approaches:
- Platforms: when the character stands on a moving body, add the platform's movement for this step to the character's move (all three engines' controllers can do this for you: Godot's
CharacterBody3Dhas platform settings, and Unreal's movement component bases the character on what it stands on). - Explosions and knockback: keep an extra "external velocity" on the character that decays over time and is added to the input move.
- Getting squashed: when a kinematic door closes on the character, a dynamic body would be crushed into the floor. Decide explicitly: stop the door, kill the player, or teleport them out.
The next two lessons build the kinematic controller itself: Collide and Slide for walls, and Slopes, Steps and Ground Snapping for floors.
Test yourself
Why do most engines ship a kinematic character controller rather than a rigid-body character?
- Kinematic bodies are cheaper to render
- Code decides the motion exactly, so stopping, steps and slopes behave the way the design wants
- Rigid bodies cannot collide with walls
- Kinematic bodies are always deterministic and rigid bodies never are
A kinematic controller walks into a 20 kg crate. What usually happens if you write no extra code?
- The crate is pushed realistically
- Nothing sensible: the solver treats the character as immovable or ignores the contact, so you write the push yourself
- The character is pushed back
- Both objects stop
When is a dynamic (rigid-body) character a good choice?
- For a precise platformer
- When the physics is the game: rolling balls, ragdoll brawlers, vehicles
- Never
- Whenever the game is 3D