What is camera bobbing in games and how is it implemented?

I've heard the term "camera bobbing" in FPS and third-person games. What exactly is it, and how do developers typically implement it? Is it purely cosmetic or does it affect gameplay? Looking for both a conceptual explanation and any code examples.
 
Camera bobbing is a subtle up-and-down or side-to-side camera movement in games that simulates a character’s walking or running motion.

It’s implemented by applying small, timed position/rotation changes (often sine wave animations) to the camera based on movement speed to make motion feel more realistic.
 
Camera bobbing in video games refers to an effect in which the camera moves vertically or horizontally when the character is walking or running.
The effect can be programmed by superimposing the camera position with minor oscillations depending on factors such as player velocity, running cycle, or animation. The amplitude and frequency of these oscillations can be modified to reflect the intensity of the movements.
 
It's that slight up and down movement you see when your character walks in FPS games, developers do it with sine wave animations tied to the player's movement speed to make it feel more realistic.
 
Camera bobbing simulates head movement during motion. Implemented using sine/cosine offsets applied to camera position, scaled by speed, updated each frame in engines like Unity.
 
Camera bobbing in games is a visual effect where the camera moves with a subtle up-and-down or side-to-side rhythm when a character walks or runs. It simulates the natural head movement of a real person in motion, making first-person and third-person games feel more realistic and immersive. Camera bobbing is purely cosmetic — it has no effect on hitboxes, collision detection, or any gameplay mechanics.
 
In Unity, camera bobbing is typically implemented by applying a Mathf.Sin(Time.time * bobSpeed) * bobAmount offset to the camera's local Y position each frame inside the Update() method. The effect should only activate when the player is moving — check this using the character controller's velocity magnitude. Use Vector3.Lerp to smoothly transition the camera back to its default position when the player stops, avoiding any sudden snapping.
 
Camera bobbing intensity varies by game genre. Walking simulators and RPGs use a slow, gentle bob to feel calm and natural. Fast-paced FPS games use stronger, quicker bobbing to convey speed and urgency. Some games layer a camera tilt or roll effect on top of the vertical bob to simulate shoulder sway, which adds extra realism. The best implementations tie all of these to the character's animation cycle so the camera movement matches actual footsteps perfectly.
 
Many games include a setting to reduce or disable camera bobbing because intense bobbing can cause motion sickness in sensitive players, especially during long sessions. If you're implementing camera bobbing in your own game, always expose the bobbing intensity as an accessibility option in the settings menu. Default to a mild bob and let players adjust it up or down. This is considered best practice and significantly improves the experience for a wider range of players.
 
Camera bobbing is implemented using a sine wave function applied to the camera's Y position (vertical) and sometimes the X position (horizontal). The sine wave creates a smooth, repeating oscillation that mimics a walking cycle. The frequency increases with player speed — so walking produces a slow gentle bob, while sprinting creates a faster, more pronounced effect. When the player stops, the bob smoothly interpolates back to zero using a Lerp function.
 
Back
Top