Particle class final

One particle, reused for the life of the system.

A pooled object rather than parallel typed arrays. Struct-of-arrays is the faster layout in principle, and at the few thousand particles a corridor shooter puts on screen the difference is not measurable — while the cost of reading fourteen parallel Float32Lists every time somebody touches this file is paid on every change. Allocated once and reused, which is the part that actually matters.

An emitter's test, or an emitter of its own, makes one with Particle().

Constructors

Particle()

Properties

affectors ↔ List<ParticleAffector>
What happens to this particle each step.
getter/setter pair
ageSeconds ↔ double
How long it has lived, in seconds.
getter/setter pair
birthSize ↔ double
The size this particle was born with.
getter/setter pair
gravity ↔ double
How hard the world this particle is in pulls it down, m/s²: its system's ParticleSystem.gravity, handed over each step, and what a ParticleGravity with no acceleration of its own reads.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
isAlive ↔ bool
Whether the slot holds a live particle: set when it is emitted, cleared when its ageSeconds reaches its lifetimeSeconds.
getter/setter pair
life → double
How far through its life, in [0, 1]: a fraction of lifetimeSeconds.
no setter
lifetimeSeconds ↔ double
How long it lives, in seconds.
getter/setter pair
linearRgba → Vector4
The particle's colour as a linear RGBA buffer: linear RGB, and an alpha that behaves as brightness, since these are drawn additively.
final
position → Vector3
Where it is, in scene space, in metres; moved by velocity each step.
final
rotation ↔ double
How far the quad is turned about the view axis, in radians.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
seed ↔ double
Set once when the particle is emitted, so an affector can vary a value per particle without asking for a random number every step and losing determinism.
getter/setter pair
size ↔ double
The billboard's width and height now, in metres.
getter/setter pair
source ↔ Object?
What emitted this, for anything that wants to measure a fire rather than guess at it. Null for a burst that nobody keyed.
getter/setter pair
velocity → Vector3
How fast and which way it moves, in metres per second.
final
wind → Vector3
The wind where this particle is, m/s: its system's world's (ParticleSystem.world), handed over each step, and what a ParticleDrag slows it against.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited