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

    Class Composites

    The Matter.Composites module contains factory methods for creating composite bodies with commonly used configurations (such as stacks and chains).

    See the included usage examples.

    Composites

    Index

    Constructors

    Methods

    • Creates a composite with simple car setup of bodies and constraints.

      Parameters

      • x: number
      • y: number
      • width: number
      • height: number
      • wheelSize: number

      Returns MatterJS.CompositeType

      A new composite car body

      car

    • Creates a composite with a Newton's Cradle setup of bodies and constraints.

      Parameters

      • x: number
      • y: number
      • number: number
      • size: number
      • length: number

      Returns MatterJS.CompositeType

      A new composite newtonsCradle body

      newtonsCradle

    • Create a new composite containing bodies created in the callback in a pyramid arrangement. This function uses the body's bounds to prevent overlaps.

      Parameters

      • x: number
      • y: number
      • columns: number
      • rows: number
      • columnGap: number
      • rowGap: number
      • callback: Function

      Returns MatterJS.CompositeType

      A new composite containing objects created in the callback

      pyramid

    • Creates a simple soft body like object.

      Parameters

      • x: number
      • y: number
      • columns: number
      • rows: number
      • columnGap: number
      • rowGap: number
      • crossBrace: boolean
      • particleRadius: number
      • particleOptions: any
      • constraintOptions: any

      Returns MatterJS.CompositeType

      A new composite softBody

      softBody

    • Create a new composite containing bodies created in the callback in a grid arrangement. This function uses the body's bounds to prevent overlaps.

      Parameters

      • x: number

        Starting position in X.

      • y: number

        Starting position in Y.

      • columns: number
      • rows: number
      • columnGap: number
      • rowGap: number
      • callback: Function

      Returns MatterJS.CompositeType

      A new composite containing objects created in the callback

      stack