@pixi/3d
    Preparing search index...

    Class BoxShape

    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;

    Implements

    Index
    depth: number = 0

    Size along z

    rainArea.depth = 40;
    
    height: number = 0

    Size along y

    rainArea.height = 0;
    
    width: number = 0

    Size along x

    rainArea.width = arenaWidth;
    
    defaultOptions: BoxShapeOptions = ...

    Defaults for every new BoxShape; an option passed as undefined keeps its default

    BoxShape.defaultOptions.height = 0;
    
    • Advanced

      Draws a point anywhere in the box, heading up

      Parameters

      • rng: () => number

        The system's random source

      • outPos: Vector3

        Receives the spawn offset, relative to the emitter

      • outDir: Vector3

        Receives +Y

      Returns void

      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);
      }
      }