Interface BodyProps<TBody>

each body contains those regardless of type

interface BodyProps<TBody> {
    angle: number;
    bbox: BBox;
    dirty: boolean;
    isCentered: boolean;
    isConvex: boolean;
    isStatic: boolean;
    isTrigger: boolean;
    offset: SATVector;
    padding: number;
    system?: BaseSystem<Body>;
    type: BodyType;
    get scaleX(): number;
    get scaleY(): number;
    draw(context): void;
    drawBVH(context): void;
    getAABBAsBBox(): BBox;
    setAngle(angle, update?): SATPolygon | Circle;
    setOffset(offset, update?): SATPolygon | Circle;
    setPosition(x, y, update?): SATPolygon | Circle;
    setScale(x, y, update?): SATPolygon | Circle;
}

Type Parameters

Hierarchy

Implemented by

Properties

angle: number

body angle in radians use deg2rad to convert

bbox: BBox

bounding box cache, without padding

dirty: boolean

was the body modified and needs update in the next checkCollision

isCentered: boolean

is body offset centered for rotation purpouses

isConvex: boolean

flag to show is it a convex body or non convex polygon

isStatic: boolean

system.separate() doesn't move this body

isTrigger: boolean

system.separate() doesn't trigger collision of this body

offset: SATVector

each body may have offset from center

padding: number

BHV padding for bounding box, preventing costly updates

system?: BaseSystem<Body>

collisions system reference

type: BodyType

type of body

Accessors

  • get scaleX(): number
  • scale getter (x)

    Returns number

  • get scaleY(): number
  • scale getter (y = x for Circle)

    Returns number

Methods

  • draw the collider

    Parameters

    • context: CanvasRenderingContext2D

    Returns void

  • draw the bounding box

    Parameters

    • context: CanvasRenderingContext2D

    Returns void

Generated using TypeDoc