Builtin Library
README.md
AudioListener
The "ears" of the scene. Spatial audio is heard relative to the entity carrying this component — its transform sets the listener position and orientation. Attach it to whatever should hear: a camera, a character, a dedicated listener rig.
Public fields: active (boolean, default true).
Methods: setActive(on).
entity.find("camera").component.add("AudioListener")
entity.find("player").component.add("AudioListener", { active = true })
A scene needs an active listener for its Audio sources to be heard positionally. Sources with no active listener are reported at load and play centered until a listener is added.
active is live: writing it takes effect on the next frame, so clearing it on the listener holding the ears hands them to another active listener, and clearing it everywhere leaves the scene with no ears. When several are active one of them drives the ears — the same one for as long as those entities live, whatever else changes about them — and the engine warns once, naming it. Recreating the entities, as a scene reload or entering play does, chooses again. audio.observe().listener reports the winner as entity, alongside present, count (how many are active) and the pose. Which one it picks is not something to author against: deactivate or remove the extras when it matters.