0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-26 13:49:01 -05:00

added Body.nextCategory

This commit is contained in:
liabru 2015-01-01 18:30:16 +00:00
parent 5888ffcaf6
commit d249165ea9

View file

@ -16,7 +16,8 @@ var Body = {};
Body._inertiaScale = 4;
var _nextCollidingGroupId = 1,
_nextNonCollidingGroupId = -1;
_nextNonCollidingGroupId = -1,
_nextCategory = 0x0001;
/**
* Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults.
@ -89,6 +90,17 @@ var Body = {};
return _nextCollidingGroupId++;
};
/**
* Returns the next unique category bitfield (starting after the initial default category `0x0001`).
* There are 32 available. See `body.collisionFilter` for more information.
* @method nextCategory
* @return {Number} Unique category bitfield
*/
Body.nextCategory = function() {
_nextCategory = _nextCategory << 1;
return _nextCategory;
};
/**
* Initialises body properties.
* @method _initProperties