The Matter.Collision module contains methods for detecting collisions between a given pair of bodies.

For efficient detection between a list of bodies, see Matter.Detector and Matter.Query.

See Matter.Engine for collision events.

Hierarchy

  • default

Constructors

Properties

_overlapAB: IOverlap = ...
_overlapBA: IOverlap = ...
_supports: IVertex[] = []

Methods

  • Find the overlap between two sets of vertices.

    Parameters

    Returns void

    Method

    _overlapAxes

  • Projects vertices on an axis and returns an interval.

    Parameters

    • projection: {
          max: number;
          min: number;
      }
      • max: number
      • min: number
    • vertices: IVertex[]
    • axis: IVector

    Returns void

    Method

    _projectToAxis

  • Detect collision between two bodies.

    Parameters

    • bodyA: IBody
    • bodyB: IBody
    • Optional pairs: null | IPairs

      Optionally reuse collision records from existing pairs.

    Returns null | ICollision

    A collision record if detected, otherwise null

    Method

    collides

  • Creates a new collision record.

    Parameters

    • bodyA: IBody

      The first body part represented by the collision record

    • bodyB: IBody

      The second body part represented by the collision record

    Returns ICollision

    A new collision record

    Method

    create

Generated using TypeDoc