pub struct ParticleEmitter {Show 17 fields
pub asset_id: AssetId,
pub texture: Option<TextureHandle>,
pub position: [f32; 3],
pub direction: [f32; 3],
pub spread_deg: f32,
pub speed_min: f32,
pub speed_max: f32,
pub lifetime_min: f32,
pub lifetime_max: f32,
pub gravity: [f32; 3],
pub spawn_rate: f32,
pub max_particles: u32,
pub size_start: f32,
pub size_end: f32,
pub color_start: [f32; 4],
pub color_end: [f32; 4],
pub visible: bool,
}Expand description
A billboard particle emitter.
Particles spawn from position in a cone centred on direction (half-angle
spread_deg), with a speed drawn from [speed_min, speed_max] and a
lifetime from [lifetime_min, lifetime_max]. Over each particle’s life its
size interpolates from size_start to size_end and its colour from
color_start to color_end. Each particle is drawn as a camera-facing quad
textured by texture.
The pool holds max_particles particles; new ones spawn at spawn_rate per
second, reusing slots as old particles die.
ParticleEmitter {
position: [0.0, 1.0, 0.0],
direction: [0.0, 1.0, 0.0],
spread_deg: 25.0,
speed_min: 2.0,
speed_max: 5.0,
lifetime_min: 0.5,
..Default::default()
};Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
texture: Option<TextureHandle>Texture sampled per particle. None uses a white fallback so
the colour gradient still shows.
position: [f32; 3]World-space spawn origin.
direction: [f32; 3]Mean emission direction. The cone of width spread_deg is centred on
this vector. Normalised on load; a zero vector falls back to [0, 1, 0].
spread_deg: f32Cone half-angle in degrees around direction. 0 emits a straight
jet; 180 emits in all directions.
speed_min: f32Lower bound on initial speed (m/s). Floored at 0.
speed_max: f32Upper bound on initial speed (m/s). Lifted to at least speed_min.
lifetime_min: f32Lower bound on particle lifetime (seconds). Must be > 0.
lifetime_max: f32Upper bound on particle lifetime (seconds). Lifted to at least
lifetime_min.
gravity: [f32; 3]Constant acceleration applied to each particle, in world units per second squared.
spawn_rate: f32Particles spawned per second. 0 produces a one-shot burst that then
empties as particles age out.
max_particles: u32Maximum number of particles alive at once. Clamped to [1, 65536].
size_start: f32Billboard side length at spawn, in world units.
size_end: f32Billboard side length at death, in world units.
color_start: [f32; 4]Linear-space RGBA multiplier applied to the texture at spawn.
color_end: [f32; 4]Linear-space RGBA multiplier applied to the texture at death.
visible: boolWhen false the emitter is skipped each frame.
Trait Implementations§
Source§impl Clone for ParticleEmitter
impl Clone for ParticleEmitter
Source§fn clone(&self) -> ParticleEmitter
fn clone(&self) -> ParticleEmitter
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 ParticleEmitter
impl Component for ParticleEmitter
Source§const NAME: &'static str = "ParticleEmitter"
const NAME: &'static str = "ParticleEmitter"
Source§fn inject_name(&mut self, id: AssetId)
fn inject_name(&mut self, id: AssetId)
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§impl ComponentSlot for ParticleEmitter
impl ComponentSlot for ParticleEmitter
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.