concinnity_core/components/audio_occlusion_probe.rs
1// src/components/audio_occlusion_probe.rs
2
3/// Runtime-only occlusion probe for a positional audio emitter.
4///
5/// The audio system attaches one to each emitter's entity and refreshes
6/// `from` (the listener) and `to` (the emitter) every frame; `PhysicsSystem`
7/// (which steps earlier) raycasts the segment against scene geometry and
8/// writes back `blocked`. The audio system then muffles the emitter when the
9/// path is blocked. The exchange is one frame behind the listener, which is
10/// inaudible. Riding the emitter's entity, the probe despawns with it.
11///
12/// Not authored in world files: it has no `args`.
13#[derive(Debug, Clone, Default)]
14pub struct AudioOcclusionProbe {
15 /// Listener position in world space (the ray origin).
16 pub from: [f32; 3],
17 /// Emitter position in world space (the ray target).
18 pub to: [f32; 3],
19 /// Whether scene geometry blocks the segment, or `None` when unanswered
20 /// (no physics in the world, or the first frame).
21 pub blocked: Option<bool>,
22}