collider - box




_height: number

inner height

_width: number

inner width

angle: number

body angle

bbox: BBox

bounding box cache, without padding

calcPoints: SATVector[]
convexPolygons: SATPolygon[]

optimization for convex polygons

edges: SATVector[]
isCentered?: boolean

flag to show is it centered

isConvex: boolean = true

boxes are convex

isStatic?: boolean

static bodies don't move but they collide

isTrigger?: boolean

trigger bodies move but are like ghosts

maxX: number

maximum x bound of body

maxY: number

maximum y bound of body

minX: number

minimum x bound of body

minY: number

minimum y bound of body

normals: SATVector[]
offset: SATVector

each body may have offset from center

padding: number = 0

bodies are not reinserted during update if their bbox didnt move outside bbox + padding

points: SATVector[]
pointsBackup: Vector[]

backup of points used for scaling

scaleVector: Vector = ...

scale Vector of body

system?: System

reference to collision system

type: Box | Point = Types.Box

type of body


  • get height(): number
  • get box height

    Returns number

  • set height(height: number): void
  • set box height, update points


    • height: number

    Returns void

  • get scale(): number
  • allow approx getting of scale

    Returns number

  • set scale(scale: number): void
  • allow easier setting of scale


    • scale: number

    Returns void

  • get scaleX(): number
  • allow exact getting of scale x - use setScale(x, y) to set

    Returns number

  • get scaleY(): number
  • allow exact getting of scale y - use setScale(x, y) to set

    Returns number

  • get width(): number
  • get box width

    Returns number

  • set width(width: number): void
  • set box width, update points


    • width: number

    Returns void

  • get x(): number
  • Returns number

  • set x(x: number): void
  • updating this.pos.x by this.x = x updates AABB


    • x: number

    Returns void

  • get y(): number
  • Returns number

  • set y(y: number): void
  • updating this.pos.y by this.y = y updates AABB


    • y: number

    Returns void


  • Draws collider on a CanvasRenderingContext2D's current path


    • context: CanvasRenderingContext2D

    Returns void

  • for setting angle


    • angle: number

    Returns SATPolygon

Generated using TypeDoc