Interface BodyOptions<UserDataType>

BodyOptions for body creation

interface BodyOptions<UserDataType> {
    angle?: number;
    group?: number;
    isCentered?: boolean;
    isStatic?: boolean;
    isTrigger?: boolean;
    padding?: number;
    userData?: UserDataType;
}

Type Parameters

  • UserDataType = any

Hierarchy (view full)

Properties

angle?: number

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

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

canInteract for how groups are used

0x7fffffff // member of all groups (can interact with everyting)
isCentered?: boolean

is body offset centered for rotation purpouses

isStatic?: boolean

system.separate() doesn't move this body

isTrigger?: boolean

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

padding?: number

BHV padding for bounding box, preventing costly updates

userData?: UserDataType

allows the user to set any misc data for client use