make3d
    Preparing search index...

    Class DynamicBody

    Hierarchy

    • Circle
      • DynamicBody

    Implements

    Index

    Constructors

    • Parameters

      • x: number
      • y: number
      • radius: number = DynamicBody.RADIUS
      • padding: number = DynamicBody.PADDING

      Returns DynamicBody

    Properties

    _group: number

    group for collision filtering

    angle: number = ...

    for compatibility reasons circle has angle

    bbox: BBox

    bounding box cache, without padding

    dirty: boolean

    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: Vector

    offset

    offsetCopy: Vector

    offset copy without angle applied

    padding: number

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

    pos: Vector
    r: number
    system?: System

    reference to collision system

    type: Circle

    circle type

    typeGroup: Circle

    faster than type

    unscaledRadius: number

    saved initial radius - internal

    userData?: any

    allows the user to set any misc data for client use

    PADDING: 0.1
    RADIUS: 0.2
    SEPARATION_DYNAMIC: 0.33
    SEPARATION_STATIC: 0.5

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

      allow get scale

      Returns number

    • set scale(scale: number): void

      shorthand for setScale()

      Parameters

      • scale: number

      Returns void

    • get scaleX(): number

      scaleX = scale in case of Circles

      Returns number

    • get scaleY(): number

      scaleY = scale in case of Circles

      Returns number

    • get x(): number

      get this.pos.x

      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

      get this.pos.y

      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

    • Draws Bounding Box on canvas context

      Parameters

      • context: CanvasRenderingContext2D

      Returns void

    • get body bounding box, without padding

      Returns BBox

    • internal for getting offset with applied angle

      Returns Vector

    • update instantly or mark as dirty

      Parameters

      • OptionalupdateNow: boolean

      Returns void

    • update position BY MOVING FORWARD IN ANGLE DIRECTION

      Parameters

      • Optionalspeed: number
      • OptionalupdateNow: boolean

      Returns Circle

    • set rotation

      Parameters

      • angle: number
      • OptionalupdateNow: boolean

      Returns Circle

    • set offset from center

      Parameters

      • offset: Vector
      • OptionalupdateNow: boolean

      Returns Circle

    • update position BY TELEPORTING

      Parameters

      • x: number
      • y: number
      • OptionalupdateNow: boolean

      Returns Circle

    • update scale

      Parameters

      • scaleX: number
      • Optional_scaleY: number
      • OptionalupdateNow: boolean

      Returns Circle

    • inner function for after position change update aabb in system

      Parameters

      • OptionalupdateNow: boolean

      Returns void