Class Point<UserDataType>

collider - point (very tiny box)

Type Parameters

  • UserDataType = any

Hierarchy (view full)

Constructors

Properties

_group: number

group for collision filtering

_height: number

inner height

_width: number

inner width

angle: number

body angle in radians use deg2rad to convert move(speed) moves at 1 speed = 1px towards angle

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 = 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

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<Body>

reference to collision system

type: Point = BodyType.Point

point type

typeGroup: Point = BodyGroup.Point

faster than type

userData?: any

allows the user to set any misc data for client use

Accessors

  • get group(): number
  • group for collision filtering

    Based on Box2D (tutorial)

    Values in BodyGroup are predefined and used each the body type and should not be used for custom filtering

    0b00000001 << 16 to 0b01000000 << 16 (max 0x7fffffff) are free to use for custom groups

    Returns number

    canInteract for how groups are used

    0x7fffffff // member of all groups (can interact with everyting)
    
  • set group(group): void
  • group for collision filtering

    Based on Box2D (tutorial)

    Values in BodyGroup are predefined and used each the body type and should not be used for custom filtering

    0b00000001 << 16 to 0b01000000 << 16 (max 0x7fffffff) are free to use for custom groups

    Parameters

    • group: number

    Returns void

    canInteract for how groups are used

    0x7fffffff // member of all groups (can interact with everyting)
    
  • get height(): number
  • get box height

    Returns number

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

    Parameters

    • height: number

    Returns void

  • get isCentered(): boolean
  • is polygon centered?

    Returns boolean

  • set isCentered(isCentered): void
  • flag to set is polygon centered

    Parameters

    • isCentered: boolean

    Returns void

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

    Returns number

  • set scale(scale): 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): void
  • set box width, update points

    Parameters

    • width: number

    Returns void

Methods

  • Draws exact collider on canvas context

    Parameters

    • context: CanvasRenderingContext2D

    Returns void

  • Draws Bounding Box on canvas context

    Parameters

    • context: CanvasRenderingContext2D

    Returns void

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

    Parameters

    • updateNow: boolean = ...

    Returns void