Physics · class
ContactEvents
Explained in Your first game, Rigid bodies.
class ContactEventsimport { ContactEvents } from '@driftengine/physics';Constructor
new
constructor(capacity?: number)| Parameter | Type | Description |
|---|---|---|
capacity? | number |
Properties
| Name | Type | Description |
|---|---|---|
data | Int32Array | kind, bodyA, bodyB per event, in that order. Read count triples. |
count | number |
Methods
begin
begin(): voidStart a tick's collection. The previous tick's set becomes what this one is compared against.
touching
touching(key: number): voidRecord 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.
| Parameter | Type | Description |
|---|---|---|
key | number |
end
end(pairA: (key: number) => number, pairB: (key: number) => number): voidDiff this tick's set against the last and write enter, stay and exit.
| Parameter | Type | Description |
|---|---|---|
pairA | (key: number) => number | |
pairB | (key: number) => number |
clear
clear(): voidForget everything, for a world whose indices have moved under it.