Physics · class

StaticRegions

Explained in Your first game, Rigid bodies.

class StaticRegions
import { StaticRegions } from '@driftengine/physics';

Constructor

new

constructor(world: PhysicsWorld)
ParameterTypeDescription
worldPhysicsWorld

Accessors

NameTypeDescription
sizegetnumberHow many regions are in the world.

Methods

has

has(region: number): boolean
ParameterTypeDescription
regionnumber

bodyOf

bodyOf(region: number): number

The body index a region stands as now, or −1. It changes as other regions are removed.

ParameterTypeDescription
regionnumber

add

add(region: number, desc: BodyDesc): number

Add a region as one body. A region already in the world is refused rather than doubled.

ParameterTypeDescription
regionnumber
descBodyDesc

remove

remove(region: number): void

Take a region out of the world. A region that is not there is nothing to remove.

ParameterTypeDescription
regionnumber