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

    Class TurbulenceField

    Push particles around with a turbulent vector field sampled at their position (Unity's Noise module in its Position mode, Niagara's Curl Noise Force): nearby particles are pushed alike, so the system swirls instead of jittering.

    The field is three channels of four-dimensional simplex noise, octaves layers deep, each layer twice as fine and half as strong as the one before. scale is the size of one noise cell per axis in the simulation space (a zero component gives no variation along that axis), velocityMultiplier the push per axis in units per second squared, and timeScale how fast the field drifts per axis. The field is built from seed, so the same settings give the same field on every run and a clone or a saved copy swirls identically; give each system its own seed for different fields. Applies in every render mode.

    For each particle wobbling on its own curve instead, or for noise in the rotation, use Noise.

    Implements

    Index
    • Parameters

      • scale: Vector3Like

        Size of one noise cell per axis, in the simulation space.

      • octaves: number

        How many layers of noise are summed; more is finer and dearer.

      • velocityMultiplier: Vector3Like

        Push per axis, in units per second squared.

      • timeScale: Vector3Like

        How fast the field drifts per axis, in noise time per second.

      • Optionalseed: number

        The seed the field is built from; 0 by default.

      Returns TurbulenceField

    initialOffset: Vector3

    The time offset the field starts from, derived from seed; restored by reset.

    octaves: number

    How many layers of noise are summed; more is finer and dearer.

    seed: number

    The seed the field is built from; 0 by default.

    timeOffset: Vector3

    Where in time the field is sampled now; starts at initialOffset and drifts by timeScale.

    type: string

    The name the behavior is registered under in BehaviorTypes.

    • get scale(): Vector3

      Size of one noise cell per axis, in the simulation space. Set it from any Vector3Like, such as a Babylon Vector3; the value is copied.

      Returns Vector3

    • set scale(value: Vector3Like): void

      Size of one noise cell per axis, in the simulation space. Set it from any Vector3Like, such as a Babylon Vector3; the value is copied.

      Parameters

      Returns void

    • get timeScale(): Vector3

      How fast the field drifts per axis, in noise time per second. Set it from any Vector3Like, such as a Babylon Vector3; the value is copied.

      Returns Vector3

    • set timeScale(value: Vector3Like): void

      How fast the field drifts per axis, in noise time per second. Set it from any Vector3Like, such as a Babylon Vector3; the value is copied.

      Parameters

      Returns void

    • get velocityMultiplier(): Vector3

      Push per axis, in units per second squared. Set it from any Vector3Like, such as a Babylon Vector3; the value is copied.

      Returns Vector3

    • set velocityMultiplier(value: Vector3Like): void

      Push per axis, in units per second squared. Set it from any Vector3Like, such as a Babylon Vector3; the value is copied.

      Parameters

      Returns void

    • A copy with the same settings that shares nothing mutable with this one.

      Returns Behavior

    • Called once per step before this behavior updates the particles, with the step's length in seconds.

      Parameters

      • delta: number

      Returns void

    • Called once per particle when it is emitted; see the interface's description for when.

      Parameters

      Returns void

    • Rewinds the field's drift to where it started, so a restarted system swirls the same way.

      Returns void

    • Called once per live particle per step, with the step's length in seconds.

      Parameters

      Returns void

    • Optional bulk form of update, applied to particles[0..count).

      The per-particle update is reached through one call site shared by every behavior type, which leaves it megamorphic: V8 can neither inline it nor specialise the generator calls inside. A behavior that implements this instead gets one call per frame and a loop it owns, where those calls are monomorphic. Implementations must skip dead particles (age >= life) exactly as the per-particle path does, and must produce identical results.

      Behaviors that do not implement it keep working unchanged. A subclass that overrides update but not updateAll has its update called, not the inherited updateAll.

      Parameters

      • particles: Particle[]
      • count: number
      • delta: number

      Returns void