Class Polygon

collider - polygon

Hierarchy (view full)

Implements

Constructors

Properties

angle: number

body angle in radians use deg2rad to convert

bbox: BBox

bounding box cache, without padding

calcPoints: SATVector[]
centered: boolean = false

is body centered

convexPolygons: SATPolygon[]

optimization for convex polygons

dirty: boolean = false

was the polygon modified and needs update in the next checkCollision

edges: SATVector[]
isConvex: boolean

is it a convex polgyon as opposed to a hollow inside (concave) polygon

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

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

points: SATVector[]
pointsBackup: Vector[]

backup of points used for scaling

pos: SATVector
scaleVector: Vector = ...

scale Vector of body

system?: System<Body>

reference to collision system

type: Ellipse | Line | Box | Point | Polygon = BodyType.Polygon

type of body

Accessors

  • 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

Methods

  • if true, polygon is not an invalid, self-crossing polygon

    Returns boolean

  • update instantly or mark as dirty

    Parameters

    • update: boolean = false

    Returns void

  • inner function for after position change update aabb in system and convex inner polygons

    Parameters

    • update: boolean = ...

    Returns void

  • update the position of the decomposed convex polygons (if any), called after the position of the body has changed

    Returns void

Generated using TypeDoc