How do static, kinematic and dynamic rigid bodies differ, and which type should an animated sliding door use?
answer
- who owns the motion
- infinite mass for two of them
- inverse mass of zero
- moved by velocity, not teleport
basics
~20 sStatic bodies never move; kinematic bodies are moved by game code or animation with infinite mass, pushing others but never pushed back; dynamic bodies have finite mass and are moved by the simulation. An animated sliding door should be kinematic.
solid answer
~40 sA static body never moves and has infinite mass: level geometry. A kinematic body is moved by the game, by setting a velocity or a target pose each step, and also has infinite mass (inverse mass zero), so it pushes dynamic bodies but nothing pushes it back. A dynamic body has finite mass and inertia, and forces and contacts move it through the simulation. An animated sliding door built as a dynamic body gets shoved because the solver applies the player's contact impulses to it while the animation writes its pose; making it kinematic fixes that. I'd drive it by velocity or target pose rather than teleporting, so the solver knows its speed, carries what rests on it through friction, and pushes crates smoothly. Kinematic-versus-static pairs get no response, since both are immovable.
go deeper
Name the three body types, who moves each one, and which ones have infinite mass, then pick kinematic for an animated door.
Explain inverse mass zero, why kinematic-versus-static pairs get no response, and why a kinematic body should be driven by a velocity or target pose instead of teleporting.
Diagnose doors and platforms that jitter, get shoved or fail to carry objects by finding two owners writing one body, and choose kinematic or a jointed dynamic body by intent.
Set a team rule for who may write a body's transform and which body type each gameplay object gets, so animation and simulation never fight over one body.
## Three kinds of rigid body Every rigid-body simulation sorts its bodies into three behaviours. The names vary slightly between engines, but the model is shared. - A **static body** never moves. It has no velocity, it is not integrated, and the simulation treats it as having **infinite mass**. Level geometry, walls, floors and rocks are static. - A **kinematic body** moves, but **the game moves it**, not the simulation: game code or an animation sets its velocity or its target pose each step. It also has infinite mass, so nothing that hits it can push it back, but because it has a velocity it pushes and carries dynamic bodies. - A **dynamic body** has finite mass and an inertia tensor, and the simulation owns its motion: forces, gravity and contacts change its velocity, and the integrator advances its position and orientation. | | Static | Kinematic | Dynamic | |---|---|---|---| | Who moves it | nobody | game code or animation | the simulation | | Velocity | always zero | set by the game | computed | | Mass seen by the solver | infinite (inverse mass 0) | infinite (inverse mass 0) | finite | | Reacts to forces and contacts | no | no | yes | | Pushes dynamic bodies | blocks them only | yes, with its velocity | yes | | Typical use | level geometry | doors, conveyors, machinery | crates, debris, ragdoll parts | ## Infinite mass as inverse mass zero Simulations store **inverse mass** and **inverse inertia**, and an immovable body simply stores zero for both. When a contact between a crate and a wall is resolved, the linear velocity change given to each body is the contact impulse multiplied by that body's inverse mass (and the angular change goes through its inverse inertia), so the wall's share is zero and the crate takes all of it. How the solver finds that impulse is a separate subject; what matters here is that static and kinematic bodies run through the same code as dynamic ones with a zero in the right place. The same idea explains which pairs produce no response at all: 1. **Kinematic against static**: both inverse masses are zero, so no impulse can change either; the kinematic body passes straight through the wall. 2. **Kinematic against kinematic**: the same, both are immovable. 3. **Static against static**: never moving, never tested. Many engines skip these pairs entirely, or report them only as overlaps when asked. A kinematic body that should stop at a wall must be stopped by game code, for example with a shape cast before it moves. ## Moving a kinematic body correctly A kinematic body should be moved by giving it a **velocity**, or a **target pose** for the end of the step from which the engine derives the velocity, `v = (target - current) / dt`. The solver then knows how fast the body's surface is moving, so: - a crate riding a kinematic drawbridge picks up its motion through friction; - a dynamic body in the way is pushed smoothly, with contacts that match the motion. **Teleporting** a kinematic body (writing its position directly) tells the solver its velocity is zero. Friction cannot carry anything, and a body it lands on appears as a deep overlap that the solver resolves as a violent pop. Moving a **static** body is worse in many engines: statics are assumed never to move and are kept in structures built for that, so moving one costs a rebuild and still reports zero velocity. ## The sliding door that players shove open The symptom: an animated sliding door was built as a **dynamic** body, and players can push it open, push it off its track, or make it jitter while the animation keeps writing its position. Two owners are fighting over one body: the animation writes a pose, the solver applies contact impulses from the player and the crates, and whichever wrote last wins that step. The fix depends on intent: - **The door follows its animation and nothing may stop it**: make it **kinematic** and drive it by velocity or target pose. Players and crates are pushed aside; they cannot shove it. - **The door should be physically pushable**: keep it **dynamic**, stop writing its position, and hold it on its track with a slider joint and a motor. Joints are a constraint-solver subject; the body-type decision is the part that belongs here. Two half-fixes come up often and are worth naming. Giving the dynamic door a huge mass makes it hard to shove, but it is still pushable and extreme mass ratios degrade an iterative solver. Turning off its gravity changes nothing about who owns its motion. ## What interviewers listen for Juniors should name the three types and the door's correct type. Stronger answers mention inverse mass zero, explain why kinematic bodies carry what rests on them while static ones do not, and say that a kinematic body's velocity, not its teleported position, is what the solver needs.
- What happens when a kinematic body runs into a static wall?Nothing physical: both bodies have zero inverse mass, so no contact impulse can change either one, and the kinematic body passes through the wall. Many engines do not even generate that pair, or report it only as an overlap. If the moving object must stop at walls, game code has to detect that, for example with a shape cast along its path, and stop it.
- Why not fix the shoved door by giving the dynamic body a very large mass?A huge mass makes the door harder to push but not immovable, so a stack of crates or a fast hit still moves it, and the animation still fights the solver. Extreme mass ratios between touching bodies also make an iterative contact solver converge poorly, so the crates against it jitter. The honest choices are kinematic for an animated door, or dynamic with a slider joint and a motor for a pushable one.
- Only a kinematic body's position matters to the solver, not its velocity.
- Teleporting a kinematic body each frame is as good as giving it a velocity.
- A kinematic body stops when it hits a static wall.
- Giving a dynamic door a huge mass makes it immovable.
- Kinematic bodies respond to gravity and contacts like dynamic ones.