three-nebula API
    Preparing search index...

    Class Collision

    Behaviour that causes particles to move away from other particles they collide with.

    Hierarchy (View Summary)

    Index
    • Constructs a Collision behaviour instance.

      Parameters

      • emitter: Emitter

        The emitter containing the particles to detect collisions against

      • useMass: boolean

        Determiens whether to use mass or not

      • onCollide: OnCollide

        Function to call when particles collide

      • Optionallife: number

        The life of the particle

      • Optionaleasing: EasingFunction

        The behaviour's decaying trend

      • isEnabled: boolean = true

        Determines if the behaviour will be applied or not

      Returns Collision

    _life: number
    age: number
    dead: boolean
    delta: Vector3D
    emitter: Emitter
    energy: number
    id: string
    isEnabled: boolean
    onCollide: OnCollide
    particles: Particle[]
    type: string
    useMass: boolean
    • get life(): number

      Gets the behaviour's life.

      Returns number

    • set life(life: number): void

      Ensures that life is infinity if an invalid value is supplied.

      Parameters

      • life: number

      Returns void

    • Compares the age of the behaviour vs integration time and determines if the behaviour should be set to dead or not.

      Parameters

      • particle: Particle
      • time: number
      • Optionalindex: number

      Returns void

    • Returns a new instance of the behaviour from the JSON object passed.

      Parameters

      • json: Record<string, unknown>

      Returns void

    • Detects collisions with other particles and calls the onCollide function on colliding particles.

      Parameters

      • particle: Particle

        the particle to apply the behaviour to

      • time: number

        particle engine time

      • Optionalindex: number

        the particle index

      Returns void

    • Resets the behaviour properties.

      Parameters

      • emitter: Emitter

        The emitter containing the particles to detect collisions against

      • useMass: boolean

        Determiens whether to use mass or not

      • onCollide: OnCollide

        Function to call when particles collide

      • Optionallife: number

        The life of the particle

      • Optionaleasing: EasingFunction

        The behaviour's decaying trend

      Returns void