phaser - v3.90.0
    Preparing search index...

    The Matter.Engine module contains methods for creating and manipulating engines. An engine is a controller that manages updating the simulation of the world. See Matter.Runner for an optional game loop utility.

    See the included usage examples.

    Engine

    Index

    Constructors

    Properties

    broadphase: MatterJS.Grid

    An instance of a broadphase controller. The default value is a Matter.Grid instance created by Engine.create.

    a Matter.Grid instance
    
    constraintIterations: number

    An integer Number that specifies the number of constraint iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. The default value of 2 is usually very adequate.

    2
    
    enabled: boolean

    A flag that specifies whether the engine is running or not.

    enableSleeping: boolean

    A flag that specifies whether the engine should allow sleeping via the Matter.Sleeping module. Sleeping can improve stability and performance, but often at the expense of accuracy.

    false
    
    pairs: any

    Collision pair set for this Engine.

    positionIterations: number

    An integer Number that specifies the number of position iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance.

    6
    

    An Object containing properties regarding the timing systems of the engine.

    velocityIterations: number

    An integer Number that specifies the number of velocity iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance.

    4
    

    A World composite object that will contain all simulated bodies and constraints.

    a Matter.World instance
    

    Methods

    • Clears the engine including the world, pairs and broadphase.

      Parameters

      Returns void

      clear

    • Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properties section below for detailed information on what you can pass via the options object.

      Parameters

      Returns MatterJS.Engine

      engine

      create

    • Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properties section below for detailed information on what you can pass via the options object.

      Parameters

      Returns MatterJS.Engine

      engine

      create

    • Merges two engines by keeping the configuration of engineA but replacing the world with the one from engineB.

      Parameters

      Returns void

      merge

    • An alias for Runner.run, see Matter.Runner for more information.

      Parameters

      Returns void

      run

    • Moves the simulation forward in time by delta ms. Triggers beforeUpdate and afterUpdate events. Triggers collisionStart, collisionActive and collisionEnd events.

      Parameters

      Returns MatterJS.Engine

      update