phaser - v3.90.0
    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

    • Chains all bodies in the given composite together using constraints.

      Parameters

      • composite: MatterJS.CompositeType
      • xOffsetA: number
      • yOffsetA: number
      • xOffsetB: number
      • yOffsetB: number
      • options: any

      Returns MatterJS.CompositeType

      A new composite containing objects chained together with constraints

      chain

    • Connects bodies in the composite with constraints in a grid pattern, with optional cross braces.

      Parameters

      Returns MatterJS.CompositeType

      The composite containing objects meshed together with constraints

      mesh

    • 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