Physics · class

ContactEvents

Explained in Your first game, Rigid bodies.

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

Constructor

new

constructor(capacity?: number)
ParameterTypeDescription
capacity?number

Properties

NameTypeDescription
dataInt32Arraykind, bodyA, bodyB per event, in that order. Read count triples.
countnumber

Methods

begin

begin(): void

Start a tick's collection. The previous tick's set becomes what this one is compared against.

touching

touching(key: number): void

Record a touching pair. Keys must arrive ascending, which the sorted pair list guarantees, because the enter and exit diff below is a merge of two sorted runs.

ParameterTypeDescription
keynumber

end

end(pairA: (key: number) => number, pairB: (key: number) => number): void

Diff this tick's set against the last and write enter, stay and exit.

ParameterTypeDescription
pairA(key: number) => number
pairB(key: number) => number

clear

clear(): void

Forget everything, for a world whose indices have moved under it.