1681-engine / index / Contact
Class: Contact ​
Defined in: src/physics/Contact.ts:35
One touching pair, kept from step to step while they touch: the impulses it ended the last step with start the next one (warm starting), which is what lets a stack settle in a few solver iterations instead of shivering.
Implements ​
Constructors ​
Constructor ​
new Contact(
a,
b,
key
): Contact;Defined in: src/physics/Contact.ts:51
Parameters ​
| Parameter | Type |
|---|---|
a | Body |
b | Body |
key | number |
Returns ​
Contact
Properties ​
a ​
readonly a: Body;Defined in: src/physics/Contact.ts:52
Implementation of ​
b ​
readonly b: Body;Defined in: src/physics/Contact.ts:53
Implementation of ​
count ​
count: number = 0;Defined in: src/physics/Contact.ts:41
depth ​
depth: number = 0;Defined in: src/physics/Contact.ts:38
Overlap along the normal, px (slightly negative while resting just apart).
Implementation of ​
enabled ​
enabled: boolean = true;Defined in: src/physics/Contact.ts:44
Solved this sub-step (false when the pre-solve hook turned it off).
key ​
readonly key: number;Defined in: src/physics/Contact.ts:54
mu ​
mu: number = 0;Defined in: src/physics/Contact.ts:42
nx ​
nx: number = 0;Defined in: src/physics/Contact.ts:36
Implementation of ​
ny ​
ny: number = 1;Defined in: src/physics/Contact.ts:37
Implementation of ​
pts ​
readonly pts: [ContactPoint, ContactPoint];Defined in: src/physics/Contact.ts:40
One or two points; only the first count are in use.
reported ​
reported: boolean = false;Defined in: src/physics/Contact.ts:49
Reported as touching (a begin went out and no end yet).
seenStep ​
seenStep: number = -1;Defined in: src/physics/Contact.ts:46
The world step and sub-step that last found it.
seenSub ​
seenSub: number = -1;Defined in: src/physics/Contact.ts:47
Accessors ​
normalImpulse ​
Get Signature ​
get normalImpulse(): number;Defined in: src/physics/Contact.ts:69
Accumulated normal impulse over the points: how hard the pair pressed together on the last sub-step.
Returns ​
number
points ​
Get Signature ​
get points(): Vec2[];Defined in: src/physics/Contact.ts:62
Where the two touch, world px.
Returns ​
Vec2[]
Where the two touch, world px: one or two points (two where an edge lies along an edge).
Implementation of ​
sensor ​
Get Signature ​
get sensor(): boolean;Defined in: src/physics/Contact.ts:57
Either body is a sensor: reported, never resolved.
Returns ​
boolean
Either body is a sensor: reported, never resolved.
Implementation of ​
Methods ​
other() ​
other(body): Body;Defined in: src/physics/Contact.ts:76
The other body of the pair.
Parameters ​
| Parameter | Type |
|---|---|
body | Body |
Returns ​
keyOf() ​
static keyOf(a, b): number;Defined in: src/physics/Contact.ts:81
A stable number for the pair, whichever order it is asked in.
Parameters ​
| Parameter | Type |
|---|---|
a | Body |
b | Body |
Returns ​
number