Added new collision pair type defs

This commit is contained in:
Richard Davey 2019-12-17 16:41:58 +00:00
parent 294ca71d5d
commit 21a6458608
5 changed files with 46 additions and 3 deletions

View file

@ -7,7 +7,7 @@
/**
* @typedef {object} Phaser.Physics.Matter.Events.CollisionActiveEvent
*
* @property {array} pairs - A list of all affected pairs in the collision.
* @property {Phaser.Types.Physics.Matter.MatterCollisionData[]} pairs - A list of all affected pairs in the collision.
* @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event.
* @property {any} source - The source object of the event.
* @property {string} name - The name of the event.

View file

@ -7,7 +7,7 @@
/**
* @typedef {object} Phaser.Physics.Matter.Events.CollisionEndEvent
*
* @property {array} pairs - A list of all affected pairs in the collision.
* @property {Phaser.Types.Physics.Matter.MatterCollisionData[]} pairs - A list of all affected pairs in the collision.
* @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event.
* @property {any} source - The source object of the event.
* @property {string} name - The name of the event.

View file

@ -7,7 +7,7 @@
/**
* @typedef {object} Phaser.Physics.Matter.Events.CollisionStartEvent
*
* @property {array} pairs - A list of all affected pairs in the collision.
* @property {Phaser.Types.Physics.Matter.MatterCollisionData[]} pairs - A list of all affected pairs in the collision.
* @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event.
* @property {any} source - The source object of the event.
* @property {string} name - The name of the event.

View file

@ -0,0 +1,22 @@
/**
* @typedef {object} Phaser.Types.Physics.Matter.MatterCollisionData
* @since 3.22.0
*
* @property {boolean} collided - Have the pair collided or not?
* @property {MatterJS.Body} bodyA - A reference to the first body involved in the collision.
* @property {MatterJS.Body} bodyB - A reference to the second body involved in the collision.
* @property {MatterJS.Body} axisBody - A reference to the dominant axis body.
* @property {number} axisNumber - The index of the dominant collision axis vector (edge normal)
* @property {number} depth - The depth of the collision on the minimum overlap.
* @property {MatterJS.Body} parentA - A reference to the parent of Body A, or to Body A itself if it has no parent.
* @property {MatterJS.Body} parentB - A reference to the parent of Body B, or to Body B itself if it has no parent.
* @property {vector} normal - The collision normal, facing away from Body A.
* @property {vector} tangent - The tangent of the collision normal.
* @property {vector} penetration - The penetration distances between the two bodies.
* @property {vector[]} supports - An array of support points, either exactly one or two points.
* @property {number} inverseMass - The resulting inverse mass from the collision.
* @property {number} friction - The resulting friction from the collision.
* @property {number} frictionStatic - The resulting static friction from the collision.
* @property {number} restitution - The resulting restitution from the collision.
* @property {number} slop - The resulting slop from the collision.
*/

View file

@ -0,0 +1,21 @@
/**
* @typedef {object} Phaser.Types.Physics.Matter.MatterCollisionPair
* @since 3.22.0
*
* @property {string} id - The unique auto-generated collision pair id. A combination of the body A and B IDs.
* @property {MatterJS.Body} bodyA - A reference to the first body involved in the collision.
* @property {MatterJS.Body} bodyB - A reference to the second body involved in the collision.
* @property {array} activeContacts - An array containing all of the active contacts between bodies A and B.
* @property {number} separation - The amount of separation that occured 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?
* @property {boolean} isSensor - Is either body A or B a sensor?
* @property {number} timeCreated - The timestamp when the collision pair was created.
* @property {number} timeUpdated - The timestamp when the collision pair was most recently updated.
* @property {Phaser.Types.Physics.Matter.MatterCollisionData} collision - The collision data object.
* @property {number} inverseMass - The resulting inverse mass from the collision.
* @property {number} friction - The resulting friction from the collision.
* @property {number} frictionStatic - The resulting static friction from the collision.
* @property {number} restitution - The resulting restitution from the collision.
* @property {number} slop - The resulting slop from the collision.
*/