This commit is contained in:
Richard Davey 2024-06-27 12:29:43 +01:00
commit 61994fa22d
No known key found for this signature in database
5 changed files with 15 additions and 11 deletions

View file

@ -27,6 +27,7 @@
* The console warnings when Audio files are missing/incorrect have been improved (thanks @samme) * 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) * 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) * `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 # Bug Fixes

View file

@ -1479,12 +1479,15 @@ var World = new Class({
continue; 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; 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 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 normalPosX = contacts[0].vertex.x;
var normalPosY = contacts[0].vertex.y; var normalPosY = contacts[0].vertex.y;
if (contacts.length === 2) if (pair.contactCount === 2)
{ {
normalPosX = (contacts[0].vertex.x + contacts[1].vertex.x) / 2; normalPosX = (contacts[0].vertex.x + contacts[1].vertex.x) / 2;
normalPosY = (contacts[0].vertex.y + contacts[1].vertex.y) / 2; normalPosY = (contacts[0].vertex.y + contacts[1].vertex.y) / 2;

View file

@ -5,7 +5,7 @@
* @property {string} id - The unique auto-generated collision pair id. A combination of the body A and B IDs. * @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} 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.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 {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} isActive - Is the collision still active or not?
* @property {boolean} confirmedActive - Has Matter determined the collision are being active yet? * @property {boolean} confirmedActive - Has Matter determined the collision are being active yet?

4
types/matter.d.ts vendored
View file

@ -990,7 +990,7 @@ declare namespace MatterJS {
bodyA: Body; bodyA: Body;
bodyB: Body; bodyB: Body;
contacts: any; contacts: any;
activeContacts: any; contactCount: number;
separation: number; separation: number;
isActive: boolean; isActive: boolean;
timeCreated: number; timeCreated: number;
@ -1030,7 +1030,7 @@ declare namespace MatterJS {
id: string; id: string;
bodyA: Body; bodyA: Body;
bodyB: Body; bodyB: Body;
activeContacts: Vector[]; contacts: Vector[];
separation: number; separation: number;
isActive: boolean; isActive: boolean;
confirmedActive: boolean; confirmedActive: boolean;

2
types/phaser.d.ts vendored
View file

@ -75729,7 +75729,7 @@ declare namespace Phaser {
/** /**
* An array containing all of the active contacts between bodies A and B. * 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. * The amount of separation that occurred between bodies A and B.
*/ */