Detect-Collisions
    Preparing search index...

    Class Circle<UserDataType>

    collider - circle

    Type Parameters

    • UserDataType = any

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    _group: number

    group for collision filtering

    angle: number

    for compatibility reasons circle has angle

    bbox: BBox

    bounding box cache, without padding

    dirty: boolean = false

    was the polygon modified and needs update in the next checkCollision

    isCentered: true

    always centered

    isConvex: true

    flag to show is it a convex body or non convex 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

    offset: SATVector

    offset

    offsetCopy: Vector = ...

    offset copy without angle applied

    padding: number

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

    r: number
    system?: System<Body>

    reference to collision system

    type: Circle = BodyType.Circle

    circle type

    typeGroup: Circle = BodyGroup.Circle

    faster than type

    unscaledRadius: number

    saved initial radius - internal

    userData?: UserDataType

    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: number): 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 scaleX(): number

      scaleX = scale in case of Circles

      Returns number

    • get scaleY(): number

      scaleY = scale in case of Circles

      Returns number

    Methods

    • Draws collider on a CanvasRenderingContext2D's current path

      Parameters

      • context: CanvasRenderingContext2D

      Returns void

    • Draws Bounding Box on canvas context

      Parameters

      • context: CanvasRenderingContext2D

      Returns void

    • update instantly or mark as dirty

      Parameters

      • updateNow: boolean = false

      Returns void

    • inner function for after position change update aabb in system

      Parameters

      • updateNow: boolean = ...

      Returns void