Skip to content

Commit

Permalink
added Body.nextCategory
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Jan 1, 2015
1 parent 5888ffc commit d249165
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/body/Body.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d249165

Please sign in to comment.