0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-30 10:20:52 -05:00

added Matter.Collision

This commit is contained in:
liabru 2021-12-08 23:36:13 +00:00
parent 2581595e6e
commit 9037f36f31

View file

@ -0,0 +1,36 @@
/**
* The `Matter.Collision` module contains methods for managing collision records.
*
* @class Collision
*/
var Collision = {};
module.exports = Collision;
(function() {
/**
* Creates a new collision record.
* @method create
* @param {body} bodyA
* @param {body} bodyB
* @return {collision} A new collision record
*/
Collision.create = function(bodyA, bodyB) {
return {
pair: null,
collided: false,
bodyA: bodyA,
bodyB: bodyB,
parentA: bodyA.parent,
parentB: bodyB.parent,
depth: 0,
normal: { x: 0, y: 0 },
tangent: { x: 0, y: 0 },
penetration: { x: 0, y: 0 },
supports: []
};
};
})();