Options
All
  • Public
  • Public/Protected
  • All
Menu

Axis Aligned collision primitive for Excalibur.

Hierarchy

  • BoundingBox

Index

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

  • get height(): number
  • get width(): number

Methods

  • getPerimeter(): number
  • hasZeroDimensions(): 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.

    Parameters

    Returns Vector

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

  • Test whether the bounding box has intersected with another bounding box, returns the side of the current bb that intersected.

    Parameters

    Returns Side

  • rayCast(ray: Ray, farClipDistance?: number): boolean
  • Determines whether a ray intersects with a bounding box

    Parameters

    • ray: Ray
    • farClipDistance: number = Infinity

    Returns boolean

  • rayCastTime(ray: Ray, farClipDistance?: number): number
  • 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

  • getSideFromIntersection(intersection: Vector): Side
  • 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