pub struct AudioEmitter {
pub clip: Option<AudioClipHandle>,
pub position: [f32; 3],
pub volume: f32,
pub looping: bool,
pub prop: Option<AssetId>,
pub min_distance: f32,
pub max_distance: f32,
pub rolloff: Rolloff,
pub bus: Option<AudioBus>,
}Expand description
A point source of sound in the world.
Plays its clip (an AudioClip reference) from position,
attenuated and panned relative to the camera. When prop names a
Prop, the emitter tracks that prop’s position every frame, so the
sound follows a moving object.
The sound is at full volume inside min_distance, fades according to
rolloff between min_distance and max_distance, and is inaudible
beyond max_distance.
AudioEmitter {
position: [6.0, 4.0, -6.0],
..Default::default()
};Fields§
§clip: Option<AudioClipHandle>The AudioClip this emitter plays.
position: [f32; 3]World-space position of the sound source.
volume: f32Linear gain multiplier applied to the clip.
looping: boolWhether the clip restarts when it ends.
prop: Option<AssetId>Optional Prop whose position the emitter tracks each frame.
min_distance: f32Distance from the listener at which the sound plays at full volume.
max_distance: f32Distance from the listener beyond which the sound is inaudible. Must
exceed min_distance.
rolloff: RolloffHow volume falls between min_distance and max_distance.
bus: Option<AudioBus>Mix bus the emitter routes through. Defaults to sfx.
Trait Implementations§
Source§impl Clone for AudioEmitter
impl Clone for AudioEmitter
Source§fn clone(&self) -> AudioEmitter
fn clone(&self) -> AudioEmitter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for AudioEmitter
impl Component for AudioEmitter
Source§const NAME: &'static str = "AudioEmitter"
const NAME: &'static str = "AudioEmitter"
Source§fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§fn inject_name(&mut self, _id: AssetId)
fn inject_name(&mut self, _id: AssetId)
Source§impl ComponentSlot for AudioEmitter
impl ComponentSlot for AudioEmitter
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.