42 · Audio · 3D (and 2D panning)

Spatial audio

Sounds that get quieter with distance and come from the right side.

In a game world, sounds should tell you where things are: louder when close, quieter far away, and panned left or right. Without that, every enemy sounds like it is standing next to you. A listener on the camera or player, plus distance falloff and panning on each source, gives players directional information.

←→↑↓ move the listenerSpace sound on/offS spatial on/offDrag the listener

Try this: Start the sound (headphones help), then walk around the campfire. Turn spatial off with S: it sounds the same everywhere.

Volume -Pan -

Sound is quiet and only plays after you press Start.

Prompt bit

Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.

Make sounds spatial: put the listener on the camera, give each source a 1 m minimum and 30 m maximum distance with logarithmic falloff and panning, keep music and UI 2D, and update source positions every frame so sounds never lag 0.1 s behind.

44 words · one sentence to paste as is

Where it's used

Common mistakes

Listener on the wrong object (sounds pan the wrong way), music and UI set to 3D so they fade when you walk away, linear falloff that goes silent too early, and source positions set once so moving enemies leave their sounds behind.

Writing this with an AI assistant? See our best AI coding assistants for game developers.

Missing a concept? Request one.

Related concepts

New concepts, in your inbox.

One short email when we add new concepts, plus our weekly roundup of AI tools for game devs. Unsubscribe any time.