audio
Installation
SKILL.md
Audio
Sound is feedback, not polish. If an action changes the game (fire, reload, pickup, hit, death, footstep, UI click) and makes no sound, the moment feels broken. Wire a sound to every such moment.
Setup
Attach one AudioListener to the camera, then choose positional vs. non-positional per sound:
const listener = new AudioListener()
camera.add(listener)
const buffer = await new AudioLoader().loadAsync('/sound-effects/gunshot.mp3')
// World event with a position → PositionalAudio attached to the source (pans + attenuates with distance)
const shot = new PositionalAudio(listener)
shot.setBuffer(buffer)
weapon.add(shot)
shot.play()