Spawns anywhere inside a box centred on the emitter and aligned with its axes, heading up
Good for rain, snow, dust motes and any volume you want filled evenly.
const snow = new ParticleSystem3D({ shape: new BoxShape({ width: 20, height: 0, depth: 20 }), gravity: 0.5, life: 8,});snow.position.y = 10; Copy
const snow = new ParticleSystem3D({ shape: new BoxShape({ width: 20, height: 0, depth: 20 }), gravity: 0.5, life: 8,});snow.position.y = 10;
Size along z
rainArea.depth = 40; Copy
rainArea.depth = 40;
Size along y
rainArea.height = 0; Copy
rainArea.height = 0;
Size along x
rainArea.width = arenaWidth; Copy
rainArea.width = arenaWidth;
Static
Defaults for every new BoxShape; an option passed as undefined keeps its default
BoxShape
undefined
BoxShape.defaultOptions.height = 0; Copy
BoxShape.defaultOptions.height = 0;
Advanced
Draws a point anywhere in the box, heading up
The system's random source
Receives the spawn offset, relative to the emitter
Receives +Y
class MyRainShape implements EmitterShape { private readonly _box = new BoxShape({ width: 20, height: 0, depth: 20 }); public sample(rng: () => number, outPos: Vector3, outDir: Vector3): void { this._box.sample(rng, outPos, outDir); outDir.set(0, -1, 0); }} Copy
class MyRainShape implements EmitterShape { private readonly _box = new BoxShape({ width: 20, height: 0, depth: 20 }); public sample(rng: () => number, outPos: Vector3, outDir: Vector3): void { this._box.sample(rng, outPos, outDir); outDir.set(0, -1, 0); }}
Spawns anywhere inside a box centred on the emitter and aligned with its axes, heading up
Good for rain, snow, dust motes and any volume you want filled evenly.
Example