babylon.quarks - v1.0.0
    Preparing search index...

    Class EffectPool

    A pool of copies of one effect, for effects played many times over: hits, footsteps, muzzle flashes, pickups.

    acquire hands out an idle copy (or makes one), places it and plays it; a copy whose every system has finished goes back to the pool by itself, so a one-shot effect needs nothing more. A looping effect is ended with stop, which lets its particles die out before the copy returns, or dropped at once with release. A ring buffer effect (ringBufferMode) never finishes, since its particles never die: release it.

    Idle copies are parked disabled, which costs the renderer nothing, and keep their place in its batches, so acquiring one allocates nothing.

    A copy disposed from outside (by its own dispose(), or with a parent it was acquired under) leaves the pool on its own, and the pool makes a new one when it needs it.

    The template itself is never played by the pool; it is only cloned. Disable it, or keep it out of the renderer, if it is not meant to be seen.

    Index
    • Takes an idle copy (making one when none is idle and the pool is under its size), places it and starts it from the beginning. The copy's transform is put back to the template's first, so a rotation or scale from its last use does not stay. Null when the pool is full or disposed.

      Parameters

      • Optionalplacement: Vector3 | EffectPlacement

        Where to put the copy, or just its position.

      • parent: Node | null = null

        The node to parent it to, when placement is a position; ignored otherwise (use EffectPlacement.parent).

      Returns TransformNode | null

    • Ends the emission of a playing copy; it returns to the pool on its own once its particles have died, looping systems included.

      Parameters

      • copy: TransformNode

      Returns void