Interface World

The world in which the physics engine runs

interface World {
    angularDamp: number;
    damp: number;
    disabledBodies: Body[];
    dynamicBodies: DynamicRigidBody[];
    exclusions: Record<number, number[]>;
    frameCount: number;
    gravity: Vector2;
    jointRestriction: number;
    joints: Joint[];
    nextId: number;
    paused: boolean;
    restTime: number;
    staticBodies: StaticRigidBody[];
}

Properties

angularDamp: number

The amount of damping to apply on angular velocity - 1 = none

damp: number

The amount of damping to apply on velocity - 1 = none

disabledBodies: Body[]

Disabled bodies (can be either static or dynamic)

dynamicBodies: DynamicRigidBody[]

The list of bodies that can move or rotate

exclusions: Record<number, number[]>

Any collision exclusions between bodies

frameCount: number

The number of frames

gravity: Vector2

The gravity to apply to all dynamic bodies

jointRestriction: number

The restriction to apply on joints to get them to stop faster

joints: Joint[]

The list of joints to be enforced

nextId: number

The next ID to assign to a body

paused: boolean

True if the world is paused

restTime: number

The time it takes for a non-moving dynamic body to go into resting state

staticBodies: StaticRigidBody[]

The list of bodies that don't move or rotate