Skip to content

ParticleAPI

Defined in: particle/ParticleAPI.ts:18

Per-app particle API. Wraps the C++ registry-scoped particle system so two App instances (e.g. editor tabs previewing different scenes) can drive independent simulations without cross-talk.

Consumed as a resource: declare Res(Particle) as a system param, or grab it with app.getResource(Particle) outside ECS code.

new ParticleAPI(module, registry, resolve?): ParticleAPI

Defined in: particle/ParticleAPI.ts:25

NonNullable<EngineApi>

whichever engine core is present — the wasm module on the web, the native host’s bindings on a device (see ecs/engineApi.ts).

CppRegistry

ParticleQueryResolver

ParticleAPI

get collisionError(): string | null

Defined in: particle/ParticleAPI.ts:40

Provider errors are visible alongside the unavailable/fallback counters.

string | null


get collisionEvents(): readonly ParticleCollisionEventPayload[]

Defined in: particle/ParticleAPI.ts:36

Contacts published by the last completed update, in project world units.

readonly ParticleCollisionEventPayload[]


get collisionStats(): readonly ParticleCollisionStats[]

Defined in: particle/ParticleAPI.ts:38

Per-emitter counters from the last update, including fallback reasons.

readonly ParticleCollisionStats[]


get debugNormals(): boolean

Defined in: particle/ParticleAPI.ts:49

Draw bounded hit normals without enabling gameplay collision events.

boolean

set debugNormals(enabled): void

Defined in: particle/ParticleAPI.ts:50

boolean

void

getAliveCount(entity): number

Defined in: particle/ParticleAPI.ts:66

number

number


play(entity): void

Defined in: particle/ParticleAPI.ts:54

number

void


reset(entity): void

Defined in: particle/ParticleAPI.ts:62

number

void


setCollisionBudget(budget): void

Defined in: particle/ParticleAPI.ts:42

Global App caps, independent of each emitter’s smaller limits.

Partial<ParticleCollisionBudget>

void


setColorLut(entity, lut): void

Defined in: particle/ParticleAPI.ts:75

Upload an entity’s baked color-over-life LUT (an N×4 RGBA Float32Array) so the sim samples it instead of start/end + easing; pass null to clear. The data is copied into the wasm heap for the call, then freed.

number

Float32Array<ArrayBufferLike> | null

void


setSizeLut(entity, lut): void

Defined in: particle/ParticleAPI.ts:81

Upload an entity’s baked size-over-life multiplier LUT (an N-scalar Float32Array), or null to clear.

number

Float32Array<ArrayBufferLike> | null

void


setSpeedLut(entity, lut): void

Defined in: particle/ParticleAPI.ts:90

Speed-over-life multiplier. Scales how fast a particle travels along the trajectory it already has — gravity, damping and noise still accumulate into its velocity, so this is not a second force system.

number

Float32Array<ArrayBufferLike> | null

void


stop(entity): void

Defined in: particle/ParticleAPI.ts:58

number

void


update(dt): void

Defined in: particle/ParticleAPI.ts:31

number

void