ParticleSystem2D
Optional feature
ParticleSystem2D is part of Particle System 2D. A build includes it only when a scene, prefab or script uses it — see Feature cropping.
From a script
ts
import { ParticleSystem2DComponent } from "mmpx";
const particleSystem2D = this.entity.TryGetComponent(ParticleSystem2DComponent);Full API: ParticleSystem2DComponent.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
Durationduration | number (0.05 … ∞) (s) | 5 | Length of one cycle — emission curves and bursts run over it |
Loopinglooping | boolean | true | |
Prewarmprewarm | boolean | false | Starts as if one full cycle had already run |
Start DelaystartDelay | MinMaxCurve (s) | 0 | Wait before emission starts (constant or random) |
Start LifetimestartLifetime | MinMaxCurve (s) | 2 | How long each particle lives. Curves run over the system's cycle |
Start SpeedstartSpeed | MinMaxCurve (px/s) | 200 | Initial speed along the shape's direction |
Separate Size AxesstartSizeSeparate | boolean | false | |
Start SizestartSize | MinMaxCurve (px) | 32 | Width in pixels (the height follows the texture's aspect) |
Start Size YstartSizeY | MinMaxCurve (px) | 32 | |
Start RotationstartRotation | MinMaxCurve (°) | 0 | |
Flip RotationflipRotation | number (0 … 1) | 0 | Share of particles that rotate the other way |
Start ColorstartColor | MinMaxGradient | 16777215 | |
Gravity ModifiergravityModifier | MinMaxCurve | 0 | × gravity (980 px/s² down). Curves run over each particle's life |
Simulation SpacesimulationSpace | "local" | "world" | "local" | Local: particles move with the entity. World: they stay where they were emitted (trails) |
Simulation SpeedsimulationSpeed | number (0 … ∞) | 1 | |
Use Unscaled TimeuseUnscaledTime | boolean | false | Ignore Game.time's time scale (still holds while the game is paused) |
Play On AwakeplayOnAwake | boolean | true | |
Max ParticlesmaxParticles | number (1 … 100000) | 1000 | |
Stop ActionstopAction | "none" | "disable" | "destroy" | "callback" | "none" | When every particle is gone after a stop or the last cycle: deactivate or destroy the entity, or just send OnParticleSystemStopped (always sent) |
Auto Random SeedautoRandomSeed | boolean | true | A new random sequence each play. Off: the same every time (randomSeed) |
Random SeedrandomSeed | number | 0 | |
Emission EnabledemissionEnabled | boolean | true | |
Shape EnabledshapeEnabled | boolean | true | |
Velocity EnabledvelocityEnabled | boolean | false | |
Limit Velocity EnabledlimitVelocityEnabled | boolean | false | |
Inherit Velocity EnabledinheritVelocityEnabled | boolean | false | |
Force EnabledforceEnabled | boolean | false | |
Color Over Lifetime EnabledcolorOverLifetimeEnabled | boolean | false | |
Color By Speed EnabledcolorBySpeedEnabled | boolean | false | |
Size Over Lifetime EnabledsizeOverLifetimeEnabled | boolean | false | |
Size By Speed EnabledsizeBySpeedEnabled | boolean | false | |
Rotation Over Lifetime EnabledrotationOverLifetimeEnabled | boolean | false | |
Rotation By Speed EnabledrotationBySpeedEnabled | boolean | false | |
Noise EnablednoiseEnabled | boolean | false | |
Collision EnabledcollisionEnabled | boolean | false | |
Texture Sheet EnabledtextureSheetEnabled | boolean | false | |
Trails EnabledtrailsEnabled | boolean | false |
Emission
| Field | Type | Default | Description |
|---|---|---|---|
Rate Over TimerateOverTime | MinMaxCurve (/s) | 10 | Particles per second. Curves run over the cycle |
Rate Over DistancerateOverDistance | MinMaxCurve (/px) | 0 | Particles per pixel the entity moves — trails |
Burstsbursts | json | [] | Extra particles at set times in the cycle |
Shape
| Field | Type | Default | Description |
|---|---|---|---|
Shapeshape | "cone" | "circle" | "edge" | "rectangle" | "point" | "cone" | |
AngleshapeAngle | number (0 … 90) (°) | 25 | Spread either side of up, widening across the base |
RadiusshapeRadius | number (0 … ∞) (px) | 10 | |
Radius ThicknessradiusThickness | number (0 … 1) | 1 | 0 emits from the edge only, 1 from the whole area |
ArcshapeArc | number (0 … 360) (°) | 360 | |
ModearcMode | "random" | "loop" | "pingPong" | "burstSpread" | "random" | Where along the arc / edge: random, sweeping round, back and forth, or each emission spread evenly |
SpreadarcSpread | number (0 … 1) | 0 | Only emit at multiples of this fraction (0 = anywhere) |
SpeedarcSpeed | number (/s) | 1 | |
LengthshapeLength | number (0 … ∞) (px) | 100 | |
Shape WidthshapeWidth | number (0 … ∞) (px) | 100 | |
Shape HeightshapeHeight | number (0 … ∞) (px) | 100 | |
Emit From EdgeemitFromEdge | boolean | false | Emit from the outline, outwards |
PositionshapePosition | [x, y] | [0,0] | |
RotationshapeRotation | number (°) | 0 | |
ScaleshapeScale | [x, y] | [1,1] | |
Align To DirectionalignToDirection | boolean | false | Turn each particle to face its starting direction |
Randomize DirectionrandomizeDirection | number (0 … 1) | 0 | |
Circularize DirectionsphericalizeDirection | number (0 … 1) | 0 | Blend towards pointing out from the centre |
Randomize PositionrandomizePosition | number (0 … ∞) (px) | 0 |
Velocity over Lifetime
| Field | Type | Default | Description |
|---|---|---|---|
Velocity XvelocityX | MinMaxCurve (px/s) | 0 | |
Velocity YvelocityY | MinMaxCurve (px/s) | 0 | |
SpacevelocitySpace | "local" | "world" | "local" | |
OrbitalorbitalVelocity | MinMaxCurve (°/s) | 0 | Circling the emitter (plus Offset) |
OffsetorbitalOffset | [x, y] | [0,0] | |
RadialradialVelocity | MinMaxCurve (px/s) | 0 | Away from (negative: towards) the orbit centre |
Speed ModifierspeedModifier | MinMaxCurve | 1 |
Limit Velocity over Lifetime
| Field | Type | Default | Description |
|---|---|---|---|
SpeedspeedLimit | MinMaxCurve (px/s) | 100 | |
Dampendampen | number (0 … 1) | 0.5 | How quickly speed over the limit is removed |
Dragdrag | MinMaxCurve | 0 | Fraction of velocity lost per second |
Multiply Drag By SizemultiplyDragBySize | boolean | false | |
Multiply Drag By VelocitymultiplyDragByVelocity | boolean | false |
Inherit Velocity
| Field | Type | Default | Description |
|---|---|---|---|
ModeinheritVelocityMode | "initial" | "current" | "initial" | Initial: particles keep the entity's velocity at birth. Current: they follow its velocity every frame |
MultiplierinheritVelocity | MinMaxCurve | 0.5 |
Force over Lifetime
| Field | Type | Default | Description |
|---|---|---|---|
Force XforceX | MinMaxCurve (px/s²) | 0 | |
Force YforceY | MinMaxCurve (px/s²) | 0 | |
SpaceforceSpace | "local" | "world" | "local" | |
RandomizeforceRandomize | boolean | false | A random force between the two values every frame (two-value modes) |
Color over Lifetime
| Field | Type | Default | Description |
|---|---|---|---|
ColorcolorOverLifetime | MinMaxGradient | see the Inspector |
Color by Speed
| Field | Type | Default | Description |
|---|---|---|---|
ColorcolorBySpeed | MinMaxGradient | see the Inspector | |
Speed RangecolorSpeedRange | [x, y] | [0,400] |
Size over Lifetime
| Field | Type | Default | Description |
|---|---|---|---|
Separate AxessizeSeparateAxes | boolean | false | |
SizesizeOverLifetime | MinMaxCurve | see the Inspector | × start size |
Size YsizeOverLifetimeY | MinMaxCurve | see the Inspector |
Size by Speed
| Field | Type | Default | Description |
|---|---|---|---|
SizesizeBySpeed | MinMaxCurve | see the Inspector | |
Speed RangesizeSpeedRange | [x, y] | [0,400] |
Rotation over Lifetime
| Field | Type | Default | Description |
|---|---|---|---|
Angular VelocityangularVelocity | MinMaxCurve (°/s) | 45 |
Rotation by Speed
| Field | Type | Default | Description |
|---|---|---|---|
Angular VelocityrotationBySpeed | MinMaxCurve (°/s) | 45 | |
Speed RangerotationSpeedRange | [x, y] | [0,400] |
Noise
| Field | Type | Default | Description |
|---|---|---|---|
StrengthnoiseStrength | MinMaxCurve (px/s) | 60 | |
FrequencynoiseFrequency | number (0 … ∞) | 0.01 | Noise cells per pixel — lower is smoother |
Scroll SpeednoiseScrollSpeed | number | 0 | Moves the noise field over time |
OctavesnoiseOctaves | number (1 … 4) | 1 | |
Octave MultipliernoiseOctaveMultiplier | number (0 … 1) | 0.5 | |
Octave ScalenoiseOctaveScale | number (1 … 4) | 2 | |
Position AmountnoisePositionAmount | number | 1 | |
Rotation AmountnoiseRotationAmount | number (°/s) | 0 | |
Size AmountnoiseSizeAmount | number (0 … 1) | 0 |
Collision
| Field | Type | Default | Description |
|---|---|---|---|
PlanecollisionPlane | Entity | — | An entity whose position and up direction (+y) is a floor particles bounce off |
Plane 2collisionPlane2 | Entity | — | |
Plane 3collisionPlane3 | Entity | — | |
Bouncebounce | number (0 … 2) | 0.5 | |
DampencollisionDampen | number (0 … 1) | 0 | Speed lost on each hit |
Lifetime LosslifetimeLoss | number (0 … 1) | 0 | Share of its life a particle loses on each hit |
Min Kill SpeedminKillSpeed | number (0 … ∞) (px/s) | 0 | Particles slower than this after a hit die |
Radius ScaleradiusScale | number (0 … 1) | 1 | Collision radius as a share of half the size |
Send Collision EventssendCollisionEvents | boolean | false | Emit a particles:collision event (and OnParticleCollision on scripts) per hit |
Sub Emitter
| Field | Type | Default | Description |
|---|---|---|---|
TriggersubEmitterTrigger | "none" | "birth" | "death" | "collision" | "none" | Make this a sub-emitter of the nearest parent particle system: emit when its particles are born (trails), die or collide |
ProbabilitysubEmitterProbability | number (0 … 1) | 1 | |
Inherit ColorsubEmitterInheritColor | boolean | false | |
Inherit SizesubEmitterInheritSize | boolean | false | |
Inherit RotationsubEmitterInheritRotation | boolean | false |
Texture Sheet Animation
| Field | Type | Default | Description |
|---|---|---|---|
Tiles XtilesX | number (1 … 64) | 1 | |
Tiles YtilesY | number (1 … 64) | 1 | |
AnimationsheetAnimation | "wholeSheet" | "singleRow" | "wholeSheet" | |
Row ModesheetRowMode | "custom" | "random" | "custom" | |
RowsheetRow | number (0 … ∞) | 0 | |
Frame Over TimeframeOverTime | MinMaxCurve | see the Inspector | 0..1 across the frames, over each particle's life |
Start FramestartFrame | MinMaxCurve | 0 | Frame offset (in frames) |
CyclessheetCycles | number (0.01 … ∞) | 1 | Times the animation runs over a life |
Trails
| Field | Type | Default | Description |
|---|---|---|---|
ModetrailMode | "particles" | "ribbon" | "particles" | Particles: each particle leaves its own trail. Ribbon: one strip joins the particles from youngest to oldest |
RatiotrailRatio | number (0 … 1) | 1 | Share of particles that get a trail |
LifetimetrailLifetime | MinMaxCurve | 0.4 | How long a trail point lasts, as a share of its particle's life |
Min Vertex DistanceminVertexDistance | number (0.5 … ∞) (px) | 6 | A new trail point once the particle has moved this far — smaller is smoother |
Ribbon CountribbonCount | number (1 … 16) | 1 | Particles are shared out between this many ribbons |
Width over TrailtrailWidth | MinMaxCurve | see the Inspector | From the head (0) to the tail (1). × the particle's size, or px with Size Affects Width off |
Size Affects WidthsizeAffectsWidth | boolean | true | |
Inherit Particle ColorinheritParticleColor | boolean | true | |
Color over LifetimetrailColorOverLifetime | MinMaxGradient | 16777215 | Over the particle's life |
Color over TrailtrailColorOverTrail | MinMaxGradient | see the Inspector | From the head (0) to the tail (1) |
TexturetrailAssetId | texture asset | — | Stretched along the trail, its height across it (empty: solid). Drawn under the particles |
Renderer
| Field | Type | Default | Description |
|---|---|---|---|
TextureassetId | texture asset | — | Every particle's image (empty: a white square). Texture sheet tiles split it; a spritesheet frame works too |
Blend ModeblendMode | "normal" | "add" | "multiply" | "screen" | "normal" | Add brightens where particles overlap — fire, sparks, magic |
Render ModerenderMode | "billboard" | "stretched" | "billboard" | Stretched: each particle is drawn along its velocity |
Length ScalelengthScale | number (0 … ∞) | 2 | |
Speed ScalespeedScale | number (0 … ∞) | 0 | Extra length per px/s of speed |
Sort ModesortMode | "youngestInFront" | "oldestInFront" | "youngestInFront" | |
Flip XflipX | number (0 … 1) | 0 | |
Flip YflipY | number (0 … 1) | 0 | |
Materialmaterial | material asset | — | A sprite-domain material drawn over all the particles at once |