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

    Class ForceOverLife

    Accelerate particles by a force that changes over their life, one curve per axis (Unity's Force over Lifetime).

    The force is in units per second squared, authored in space: world axes by default, or the emitter's own axes with 'local', in which case it turns with the emitter. Either way it scales with the emitter, as Unity's does: a world force is multiplied by the system's motionScale in a world-space system, and only turned into the emitter's axes in a local-space one, whose frame scales it. Without scaleWithEmitter it keeps its strength in world units however the emitter is scaled, as Unity's gravity does. With randomized, a random force (a random range or random between curves) is picked again every step, as Unity's Randomize does. Applies in every render mode.

    Implements

    Index
    • Parameters

      • x: ValueGenerator | FunctionValueGenerator

        Force along X over the particle's life, in units per second squared.

      • y: ValueGenerator | FunctionValueGenerator

        Force along Y over the particle's life, in units per second squared.

      • z: ValueGenerator | FunctionValueGenerator

        Force along Z over the particle's life, in units per second squared.

      • Optionalspace: BehaviorSpace

        The space the force is authored in; 'world' by default.

      • Optionalrandomized: boolean

        Whether a random component (an IntervalValue or a RandomBetweenCurves) picks a new value every step instead of once per particle, as Unity's Randomize of Force over Lifetime: the force jitters from step to step and averages out over the range, rather than pushing each particle steadily its own way. False by default. A component that is not random reads the same either way.

      • OptionalscaleWithEmitter: boolean

        Whether the force scales with the emitter, as Unity's Force over Lifetime does; true by default. False keeps its strength in world units however the emitter or its parents are scaled, in either simulation space, as Unity's gravity (the Gravity Modifier) does: a smaller copy of an effect then falls as fast as the full-size one.

      Returns ForceOverLife

    _frame: EmitterFrame

    The emitter's transform this frame, refreshed by frameUpdate.

    Learned in initialize, so undefined until this behavior sees a particle.

    randomized: boolean

    Whether a random component (an IntervalValue or a RandomBetweenCurves) picks a new value every step instead of once per particle, as Unity's Randomize of Force over Lifetime: the force jitters from step to step and averages out over the range, rather than pushing each particle steadily its own way. False by default. A component that is not random reads the same either way.

    scaleWithEmitter: boolean

    Whether the force scales with the emitter, as Unity's Force over Lifetime does; true by default. False keeps its strength in world units however the emitter or its parents are scaled, in either simulation space, as Unity's gravity (the Gravity Modifier) does: a smaller copy of an effect then falls as fast as the full-size one.

    The space the force is authored in; 'world' by default.

    type: string

    The name the behavior is registered under in BehaviorTypes.

    Force along X over the particle's life, in units per second squared.

    Force along Y over the particle's life, in units per second squared.

    Force along Z over the particle's life, in units per second squared.

    • What the force is multiplied by before it reaches the velocity: the step, and the system's motionScale for a world force in a world-space system that scales with the emitter. An unknown system (before initialize) counts as world space.

      Parameters

      • delta: number

      Returns number

    • 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

    • Called when the system restarts (not when a looping system starts its next loop): forget state accumulated across steps, so the replay starts as the first play did.

      Returns void

    • The behavior's settings as plain data, with its type; see the interface's description.

      Returns ForceOverLifeJSON

    • 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