phaser - v4.0.0-rc.4
    Preparing search index...

    The Gravity Well Particle Processor applies a force on the particles to draw them towards, or repel them from, a single point.

    The force applied is inversely proportional to the square of the distance from the particle to the point, in accordance with Newton's law of gravity.

    This simulates the effect of gravity over large distances (as between planets, for example).

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Parameters

      • Optionalx: number | GravityWellConfig

        The x coordinate of the Gravity Well, in world space. Default 0.

      • Optionaly: number

        The y coordinate of the Gravity Well, in world space. Default 0.

      • Optionalpower: number

        The strength of the gravity force - larger numbers produce a stronger force. Default 0.

      • Optionalepsilon: number

        The minimum distance for which the gravity force is calculated. Default 100.

      • Optionalgravity: number

        The gravitational force of this Gravity Well. Default 50.

      Returns GravityWell

    Properties

    active: boolean

    The active state of the Particle Processor.

    An inactive Particle Processor will be skipped for processing by its parent Emitter.

    epsilon: number

    The minimum distance for which the gravity force is calculated.

    Defaults to 100.

    gravity: number

    The gravitational force of this Gravity Well.

    Defaults to 50.

    A reference to the Particle Emitter that owns this Processor. This is set automatically when the Processor is added to an Emitter and nulled when removed or destroyed.

    power: number

    The strength of the gravity force - larger numbers produce a stronger force.

    Defaults to 0.

    x: number

    The x coordinate of the Particle Processor, in world space.

    y: number

    The y coordinate of the Particle Processor, in world space.

    Methods

    • Destroys this Particle Processor by removing all external references.

      This is called automatically when the owning Particle Emitter is destroyed.

      Returns void

    • Takes a Particle and updates it based on the properties of this Gravity Well.

      Parameters

      • particle: Particle

        The Particle to update.

      • delta: number

        The delta time in ms.

      • step: number

        The delta value divided by 1000.

      Returns void