Expand description
Particle emitters: fire, smoke, sparks, rain, snow, magic dust.
A ParticleEmitter simulates its particles on the CPU and draws them as camera-facing quads
in one DynamicMesh (one draw call per emitter). Particles live in world space, so they trail
behind a moving emitter. Colours and fading are done by the built-in particle shader.
use kvas_engine::{prelude::*, scene::Scene, runtime::Runtime};
let mut scene = Scene::default();
let fire = scene.spawn("Campfire");
scene.world.insert(fire, ParticleEmitter::preset("fire"));
let mut runtime = Runtime::new(scene, None);
for _ in 0..30 { runtime.tick(1.0 / 30.0); }
assert!(runtime.scene.world.get::<ParticleEmitter>(fire).unwrap().alive() > 0);Structs§
- Particle
Emitter - A particle emitter.
Enums§
- Emitter
Shape - Where new particles appear.
Functions§
- update
- Simulates every emitter and refreshes its mesh and material.
simulateis false in the editor outside Play: emitters then animate from wall-clocktimeso they can be previewed.