collider - box

Hierarchy

Constructors

Properties

_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

Accessors

  • get height(): number
  • get box height

    Returns number

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

    Parameters

    • height: number

    Returns void

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

    Returns number

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

    Parameters

    • 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

    Parameters

    • width: number

    Returns void

  • get x(): number
  • Returns number

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

    Parameters

    • x: number

    Returns void

  • get y(): number
  • Returns number

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

    Parameters

    • y: number

    Returns void

Methods

  • Draws collider on a CanvasRenderingContext2D's current path

    Parameters

    • context: CanvasRenderingContext2D

    Returns void

  • for setting angle

    Parameters

    • angle: number

    Returns SATPolygon

Generated using TypeDoc