Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shakiba committed Jul 23, 2024
1 parent 0d2efe6 commit ca98be9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/pages/api/classes/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ ___
**setFriction**(`friction`: number): *void*

Override the default friction mixture. You can call this in
ContactListener.preSolve. This value persists until set or reset.
"pre-solve" callback. This value persists until set or reset.

**Parameters:**

Expand All @@ -287,7 +287,7 @@ ___
**setRestitution**(`restitution`: number): *void*

Override the default restitution mixture. You can call this in
ContactListener.preSolve. The value persists until you set or reset.
"pre-solve" callback. The value persists until you set or reset.

**Parameters:**

Expand Down
4 changes: 2 additions & 2 deletions docs/pages/api/classes/world.md
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ contact manifold (e.g. disable contact). A copy of the old manifold is
provided so that you can detect changes. Note: this is called only for awake
bodies. Note: this is called even when the number of contact points is zero.
Note: this is not called for sensors. Note: if you set the number of contact
points to zero, you will not get an endContact callback. However, you may get
a beginContact callback the next step.
points to zero, you will not get an end-contact callback. However, you may get
a begin-contact callback the next step.

Warning: You cannot create/destroy world entities inside these callbacks.

Expand Down
7 changes: 3 additions & 4 deletions docs/pages/contacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,15 @@ so you will need to disable the contact every time-step. The pre-solve
event may be fired multiple times per time-step per contact due to
continuous collision detection.

```js
void PreSolve(Contact* contact, Manifold* oldManifold)
{
```ts
world.on('pre-solve', function(contact: Contact, oldManifold: Manifold) {
WorldManifold worldManifold;
contact.getWorldManifold(&worldManifold);
if (worldManifold.normal.y < -0.5)
{
contact.setEnabled(false);
}
}
});
```

The pre-solve event is also a good place to determine the point state
Expand Down
4 changes: 2 additions & 2 deletions src/dynamics/Contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ export class Contact {

/**
* Override the default friction mixture. You can call this in
* ContactListener.preSolve. This value persists until set or reset.
* "pre-solve" callback. This value persists until set or reset.
*/
setFriction(friction: number): void {
this.m_friction = friction;
Expand All @@ -483,7 +483,7 @@ export class Contact {

/**
* Override the default restitution mixture. You can call this in
* ContactListener.preSolve. The value persists until you set or reset.
* "pre-solve" callback. The value persists until you set or reset.
*/
setRestitution(restitution: number): void {
this.m_restitution = restitution;
Expand Down
4 changes: 2 additions & 2 deletions src/dynamics/World.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,8 @@ export class World {
* provided so that you can detect changes. Note: this is called only for awake
* bodies. Note: this is called even when the number of contact points is zero.
* Note: this is not called for sensors. Note: if you set the number of contact
* points to zero, you will not get an endContact callback. However, you may get
* a beginContact callback the next step.
* points to zero, you will not get an end-contact callback. However, you may get
* a begin-contact callback the next step.
*
* Warning: You cannot create/destroy world entities inside these callbacks.
*/
Expand Down

0 comments on commit ca98be9

Please sign in to comment.