Add a body bob and sway to walking that fades smoothly when the character stops
A little up-and-down and side-to-side motion makes a walking character or first-person camera feel alive, but when it is tied to a timer it keeps bobbing on the spot, and when it is cut off at a stop the picture jerks. Here is how to tie it to the steps and let it fade.
Why this works
The body dips each time a foot lands, so a bob that follows the steps lines up with what the player expects. Scaling it by smoothed speed means it fades as the walk fades, and with no distance covered it cannot keep going.
When not to use it
Wrong for a game meant for long sessions in a first-person view, or aimed at people prone to motion sickness, unless it can be turned down or off. It also fits poorly for gliding, swimming or vehicles, which have no footsteps.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- 22 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Add a body bob and sway to walking that fades smoothly when the character stops" (read_entry walking-bob-and-sway-that-fade-out-when-stopping) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP