From ca98be96ae0e3b1a1c2dddcc67aa6996c15d6b6b Mon Sep 17 00:00:00 2001 From: Ali Shakiba Date: Tue, 23 Jul 2024 23:10:43 +0330 Subject: [PATCH] update docs --- docs/pages/api/classes/contact.md | 4 ++-- docs/pages/api/classes/world.md | 4 ++-- docs/pages/contacts.md | 7 +++---- src/dynamics/Contact.ts | 4 ++-- src/dynamics/World.ts | 4 ++-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/docs/pages/api/classes/contact.md b/docs/pages/api/classes/contact.md index 11c4b60e..76bd0b77 100644 --- a/docs/pages/api/classes/contact.md +++ b/docs/pages/api/classes/contact.md @@ -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:** @@ -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:** diff --git a/docs/pages/api/classes/world.md b/docs/pages/api/classes/world.md index 22db15fe..fe44d459 100644 --- a/docs/pages/api/classes/world.md +++ b/docs/pages/api/classes/world.md @@ -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. diff --git a/docs/pages/contacts.md b/docs/pages/contacts.md index ef5238bb..42c9a221 100644 --- a/docs/pages/contacts.md +++ b/docs/pages/contacts.md @@ -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 diff --git a/src/dynamics/Contact.ts b/src/dynamics/Contact.ts index 4b78823d..52c90382 100644 --- a/src/dynamics/Contact.ts +++ b/src/dynamics/Contact.ts @@ -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; @@ -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; diff --git a/src/dynamics/World.ts b/src/dynamics/World.ts index cfb9aa86..5628ddc2 100644 --- a/src/dynamics/World.ts +++ b/src/dynamics/World.ts @@ -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. */