From 0458e4ab014e5bf168424e29ba4b93bc24f498e0 Mon Sep 17 00:00:00 2001 From: Zeke Chan Date: Thu, 27 Jun 2024 17:05:39 +0800 Subject: [PATCH 1/5] Update MatterCollisionPair.js Changed `activeContacts` to `contacts` --- src/physics/matter-js/typedefs/MatterCollisionPair.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/matter-js/typedefs/MatterCollisionPair.js b/src/physics/matter-js/typedefs/MatterCollisionPair.js index da09c1f7f..c8c6eed5b 100644 --- a/src/physics/matter-js/typedefs/MatterCollisionPair.js +++ b/src/physics/matter-js/typedefs/MatterCollisionPair.js @@ -5,7 +5,7 @@ * @property {string} id - The unique auto-generated collision pair id. A combination of the body A and B IDs. * @property {MatterJS.BodyType} bodyA - A reference to the first body involved in the collision. * @property {MatterJS.BodyType} bodyB - A reference to the second body involved in the collision. - * @property {MatterJS.Vector[]} activeContacts - An array containing all of the active contacts between bodies A and B. + * @property {MatterJS.Vector[]} contacts - An array containing all of the active contacts between bodies A and B. * @property {number} separation - The amount of separation that occurred between bodies A and B. * @property {boolean} isActive - Is the collision still active or not? * @property {boolean} confirmedActive - Has Matter determined the collision are being active yet? From 05a814dc1d82266b60f0a383cb18f995182510f0 Mon Sep 17 00:00:00 2001 From: Zeke Chan Date: Thu, 27 Jun 2024 17:06:44 +0800 Subject: [PATCH 2/5] Update World.js Updated `pair.activeContacts.length` to use new `pair.contactCount` property --- src/physics/matter-js/World.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/physics/matter-js/World.js b/src/physics/matter-js/World.js index 892e43523..ed2a48398 100644 --- a/src/physics/matter-js/World.js +++ b/src/physics/matter-js/World.js @@ -1479,12 +1479,15 @@ var World = new Class({ continue; } - for (var j = 0; j < pair.activeContacts.length; j++) + for (var j = 0; j < pair.contactCount; j++) { - var contact = pair.activeContacts[j]; + var contact = pair.contacts[j]; var vertex = contact.vertex; - - graphics.fillRect(vertex.x - 2, vertex.y - 2, 5, 5); + + if (vertex) + { + graphics.fillRect(vertex.x - 2, vertex.y - 2, 5, 5); + } } } @@ -1500,14 +1503,14 @@ var World = new Class({ } var collision = pair.collision; - var contacts = pair.activeContacts; + var contacts = pair.contacts; - if (contacts.length > 0) + if (pair.contactCount > 0) { var normalPosX = contacts[0].vertex.x; var normalPosY = contacts[0].vertex.y; - if (contacts.length === 2) + if (pair.contactCount === 2) { normalPosX = (contacts[0].vertex.x + contacts[1].vertex.x) / 2; normalPosY = (contacts[0].vertex.y + contacts[1].vertex.y) / 2; From 8c5630f8bc59e4d5a5cb95964e5fb2d49d79b719 Mon Sep 17 00:00:00 2001 From: Zeke Chan Date: Thu, 27 Jun 2024 17:07:35 +0800 Subject: [PATCH 3/5] Update phaser.d.ts Changed `activeContacts` to `contacts` --- types/phaser.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/phaser.d.ts b/types/phaser.d.ts index 1df3c056f..b416946fc 100644 --- a/types/phaser.d.ts +++ b/types/phaser.d.ts @@ -75729,7 +75729,7 @@ declare namespace Phaser { /** * An array containing all of the active contacts between bodies A and B. */ - activeContacts: MatterJS.Vector[]; + contacts: MatterJS.Vector[]; /** * The amount of separation that occurred between bodies A and B. */ From 0c12b62ec89eab7afb8ac5c188fa950ccd9fc500 Mon Sep 17 00:00:00 2001 From: Zeke Chan Date: Thu, 27 Jun 2024 17:08:02 +0800 Subject: [PATCH 4/5] Update matter.d.ts Added `contactCount` --- types/matter.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/matter.d.ts b/types/matter.d.ts index a01f4cc38..9a1ca2cd6 100644 --- a/types/matter.d.ts +++ b/types/matter.d.ts @@ -990,7 +990,7 @@ declare namespace MatterJS { bodyA: Body; bodyB: Body; contacts: any; - activeContacts: any; + contactCount: number; separation: number; isActive: boolean; timeCreated: number; @@ -1030,7 +1030,7 @@ declare namespace MatterJS { id: string; bodyA: Body; bodyB: Body; - activeContacts: Vector[]; + contacts: Vector[]; separation: number; isActive: boolean; confirmedActive: boolean; From ec8fd00c487ec5f54e64d841fca1b905b12a7c67 Mon Sep 17 00:00:00 2001 From: Zeke Chan Date: Thu, 27 Jun 2024 17:14:17 +0800 Subject: [PATCH 5/5] Update CHANGELOG-v3.85.md --- changelog/3.85/CHANGELOG-v3.85.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog/3.85/CHANGELOG-v3.85.md b/changelog/3.85/CHANGELOG-v3.85.md index 2c34adadd..046d0f399 100644 --- a/changelog/3.85/CHANGELOG-v3.85.md +++ b/changelog/3.85/CHANGELOG-v3.85.md @@ -27,6 +27,7 @@ * The console warnings when Audio files are missing/incorrect have been improved (thanks @samme) * The `requestVideoFrame` polyfill has been updated to the latest release, which should resolve some SSR framework issues. Fix #6776 (thanks @lantictac) * `ScaleManager` listeners includes checks for the `screen.orientation` object and adds/removes a `change` eventListener method to handle screen orientation changes on mobile devices. The `orientationchange` event is still maintained for backwards compatibility. Fix #6837 (thanks @rexrainbow) +* Updated MatterJS to 0.20.0 # Bug Fixes