mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
added Matter.Collision
This commit is contained in:
parent
2581595e6e
commit
9037f36f31
1 changed files with 36 additions and 0 deletions
36
src/collision/Collision.js
Normal file
36
src/collision/Collision.js
Normal 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: []
|
||||
};
|
||||
};
|
||||
|
||||
})();
|
Loading…
Reference in a new issue