Examples
import { AppSchedule } from '@wimaengine/core'
import { emitParticles2D } from '@wimaengine/emitter'
app.registerSystem({
schedule: AppSchedule.Update,
system: emitParticles2D
})Function
emitParticles2D(world: World): voidEmits world-space 2D particle entities for eligible emitters.
The query matches entities with GlobalTransform2D, Emitter,
and Timer. Disabled emitters and emitters whose timer has not started
a cycle are skipped. For each remaining emitter, the system samples and rounds
the configured burst count, decomposes the current global transform, then
queues that many entities with copied Position2D and
Orientation2D, a Particle marker, and a Timer
whose duration is a sampled lifetime.
When configured, Emitter#prefab supplies components before the
particle components are inserted. After each entity is built,
Emitter#patch receives the shared EntityCommands instance
and the new EntityHandle. Component insertion and later despawning
are deferred through the world’s command queue.
The emitter plugin registers this function in the repeating Update schedule.
import { AppSchedule } from '@wimaengine/core'
import { emitParticles2D } from '@wimaengine/emitter'
app.registerSystem({
schedule: AppSchedule.Update,
system: emitParticles2D
})