Party Bobbing¶
PartyBobbing adds a continuous sinusoidal camera bob while the party is walking. Unlike the one-shot step-bob built into PartyVisuals, this effect runs every frame the party is animating — giving the camera a smooth, rhythmic up-and-down sway that sells the feeling of walking through a dungeon.
When the party stops, the camera smoothly returns to its rest position.
Requires PartyVisuals on the same GameObject.
Setup¶
- Select the party root (the GameObject with
PartyVisuals). - Add Component → Party Bobbing.
- Optionally drag your camera
Transforminto Camera — the component auto-detects it from children if left empty. - Tune Bob Height and Steps Per Second to taste.
Inspector reference¶
Bobbing¶
| Field | Default | Range | What it does |
|---|---|---|---|
| Bob Height | 0.05 m | 0.01 – 0.15 | Peak vertical offset in meters on each sine cycle. Higher = more dramatic bob. |
| Steps Per Second | 2 | 1 – 4 | How many full up-down cycles happen per second. 2 gives a natural left-right-left gait; 1 is a slow lurch; 4 is a sprint. |
Camera¶
| Field | What it does |
|---|---|
| Camera | The Transform to apply the bob to. Auto-detected from children (GetComponentInChildren<Camera>) if left empty. If no camera is found, the component disables itself. |
Behaviour¶
Each LateUpdate:
- If
PartyVisuals.IsAnimatingistrue— the bob phase advances and the camera is offset bysin(phase) * bobHeighton the Y axis. - If the party is not animating — the phase resets to
0and the camera lerps back to its rest position (initialLocalOffset) at 10× speed, so it snaps back quickly without a jarring cut.
The component stores the camera's localPosition at Awake as the rest offset, so the bob is additive — it works regardless of where the camera sits relative to the party root.
Relationship to PartyVisuals step-bob¶
PartyVisuals has its own Move Curve + Bob Height that fires once per step, integrated into the slide animation coroutine. That bob is keyed to the step timing and always plays exactly once per move.
PartyBobbing is a separate, continuous oscillation driven by sin. You can use:
- Both — the
PartyVisualsbob shapes the step, andPartyBobbingadds an overlaid sway. PartyVisualsonly — setPartyBobbingdisabled or remove it; you still get the per-step bob.PartyBobbingonly — setPartyVisuals.bobHeightto0; the continuous sway replaces the step bob.
Troubleshooting¶
Component disables itself on play
No Camera component was found in the party root's children. Either assign the camera Transform manually in the Camera field, or make sure the Camera GameObject is a child of the party root.
Camera bobs but never returns to rest
The camera's localPosition is being overwritten by another component (e.g. PartyLook or PartyFallAnimation) every frame. PartyBobbing uses LateUpdate but so does PartyLook; execution order matters. Check Project Settings → Script Execution Order if the rest position drifts.
Bob is too strong / too weak
Bob Height and Steps Per Second are both exposed in the Inspector and can be changed at runtime. Try lowering bobHeight to 0.02–0.03 for a subtle effect, or 0.08–0.12 for an exaggerated cinematic bob.
Dungeon Crawler Framework — Mantis3de