Axis Aligned collision primitive for Excalibur.

Hierarchy

  • BoundingBox

Constructors

  • Constructor allows passing of either an object with all coordinate components, or the coordinate components passed separately.

    Parameters

    • leftOrOptions: number | BoundingBoxOptions = 0

      Either x coordinate of the left edge or an options object containing the four coordinate components.

    • top: number = 0

      y coordinate of the top edge

    • right: number = 0

      x coordinate of the right edge

    • bottom: number = 0

      y coordinate of the bottom edge

    Returns BoundingBox

Properties

bottom: number
left: number
right: number
top: number

Accessors

Methods

  • Return whether the bounding box has zero dimensions in height,width or both

    Returns boolean

  • Test wether this bounding box intersects with another returning the intersection vector that can be used to resolve the collision. If there is no intersection null is returned.

    Returns

    A Vector in the direction of the current BoundingBox, this <- other

    Parameters

    Returns Vector

  • Returns true if the bounding boxes overlap.

    Parameters

    • other: BoundingBox
    • Optional epsilon: number

      Optionally specify a small epsilon (default 0) as amount of overlap to ignore as overlap. This epsilon is useful in stable collision simulations.

    Returns boolean

  • Determines whether a ray intersects with a bounding box

    Parameters

    • ray: Ray
    • farClipDistance: number = Infinity

    Returns boolean

  • Rotates a bounding box by and angle and around a point, if no point is specified (0, 0) is used by default. The resulting bounding box is also axis-align. This is useful when a new axis-aligned bounding box is needed for rotated geometry.

    Parameters

    • angle: number
    • point: Vector = Vector.Zero

    Returns BoundingBox

  • Given bounding box A & B, returns the side relative to A when intersection is performed.

    Parameters

    • intersection: Vector

      Intersection vector between 2 bounding boxes

    Returns Side