Options
All
  • Public
  • Public/Protected
  • All
Menu

Axis Aligned collision primitive for Excalibur.

Hierarchy

  • BoundingBox

Implements

Index

Constructors

constructor

  • new BoundingBox(left?: number, top?: number, right?: number, bottom?: number): BoundingBox
  • Parameters

    • Default value left: number = 0

      x coordinate of the left edge

    • Default value top: number = 0

      y coordinate of the top edge

    • Default value right: number = 0

      x coordinate of the right edge

    • Default value bottom: number = 0

      y coordinate of the bottom edge

    Returns BoundingBox

Properties

bottom

bottom: number

y coordinate of the bottom edge

left

left: number

x coordinate of the left edge

right

right: number

x coordinate of the right edge

top

top: number

y coordinate of the top edge

Methods

collides

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

    Parameters

    Returns Vector

combine

contains

debugDraw

  • debugDraw(ctx: CanvasRenderingContext2D, color?: Color): void

getHeight

  • getHeight(): number

getPerimeter

  • getPerimeter(): number

getPoints

getWidth

  • getWidth(): number

rayCast

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

    Parameters

    • ray: Ray
    • Default value farClipDistance: number = Infinity

    Returns boolean

rayCastTime

  • rayCastTime(ray: Ray, farClipDistance?: number): number

rotate

  • 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
    • Default value point: Vector = Vector.Zero.clone()

    Returns BoundingBox

toPolygon

Static fromPoints