Bodies
Learning paths through this topic
Arm and leg reach
You say where the hand or foot should go, and it works out where the elbow or knee goes. Feet stay on stairs, hands reach for ledges, and a robot arm follows the mouse.
Idle sway
Makes a character that stands still look alive: it breathes and sways a little, with no visible loop. Two characters never move in step, so a crowd looks like people and not like a copy.
A player's connection drops mid-jump and their body hangs in the air for everyone
When messages from a player stop, the others see a frozen body in whatever pose it had, often the middle of a leap, and sometimes it stays for minutes. Players think they are looking at a cheater. Here is a staged way to show that someone is gone and to let the body leave the scene calmly.
Sixty players on screen make the game slow because every body is animated every frame
Far-away characters are tiny but cost as much as the ones next to you. Animating them less often saves a lot, until all of them update on the same frame and the game stutters in a rhythm, or until they walk in slow motion. Here is how to spread the work and keep the speed right.
Let archers and turrets shoot only once their body points near enough at the target
If a unit fires the moment it is told to, arrows leave while the body still faces somewhere else, and it looks like cheating. If it demands a perfect aim, it never shoots at all. Here is a tolerance that depends on how big the target looks from where the shooter stands.
Make an arm or leg reach a target, bending the right way and stretching when too far
Hands that grab a ledge or feet that rest on stairs need the joint in between to land in a believable place. The usual attempt gives NaN values for unreachable targets, bends the wrong way, or makes the elbow pop from one side to the other. Here is the solution for two-part limbs.
Swing a battering ram so that it hits the gate at its fastest, at a known moment
A ram drawn forward with a smooth easing arrives slowly, and the blow feels like a touch. Swung like a pendulum it arrives fastest, as it should. This entry gives the motion in four steps, the exact moment of impact for sound, damage and dust, and a damage value that follows the real speed of the blow.
Keep a battlefield from filling with bodies: fade the oldest out, no sudden pops
A long battle leaves thousands of bodies, which cost speed and hide the living. Deleting them after a timer makes whole piles vanish in one frame, and deleting the oldest when a limit is hit makes single bodies pop away in front of the player. Here is a rule with a limit and a gentle fade that behaves the same in every situation.
Tall and short characters share a walk animation and the small ones skate
Players in an online game choose their own size, and one animation has to serve a tiny and a giant body. Run it at the same rate for all and the small feet blur over the ground or the big ones shuffle. Here is the rate to use, which clip to pick, and the point where no rate is right.
Stop units stuck in a queue from running on the spot, and restart them cleanly
When a corridor is jammed, soldiers pressed against each other keep their legs going while hardly moving, like cartoon characters before a cliff. Switching to a waiting pose the moment the speed dips makes them flicker in a slow queue. This entry decides when a unit counts as blocked, and when it counts as free again.
Make a catapult throw to a chosen distance, with the stone leaving from the tip of the arm
A catapult in a strategy game is usually a stone that appears from nowhere while the arm does its own thing. If the arm and the stone follow the same physics, the arm swing tells the player how far it will throw. This entry joins them: speed of the tip, release angle and the place where the stone is born, worked out from the distance wanted.
Make riders and fast units tilt into a turn the right amount, and ease back upright
A horse that runs round a corner bolt upright looks like it is gliding on rails, and one that tilts by a fixed angle looks drunk when it turns slowly. This entry ties the tilt to speed and how sharp the turn is, with a limit, and moves smoothly so a jittery path does not make the body shake.