mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-26 13:49:01 -05:00
fix Demo.reset to fully reset ids
This commit is contained in:
parent
19656cd5d1
commit
500d566772
2 changed files with 12 additions and 9 deletions
|
@ -24,7 +24,8 @@
|
|||
}
|
||||
|
||||
// Matter aliases
|
||||
var Example = Matter.Example,
|
||||
var Body = Matter.Body,
|
||||
Example = Matter.Example,
|
||||
Engine = Matter.Engine,
|
||||
World = Matter.World,
|
||||
Common = Matter.Common,
|
||||
|
@ -295,6 +296,9 @@
|
|||
demo.sceneEvents = [];
|
||||
|
||||
// reset id pool
|
||||
Body._nextCollidingGroupId = 1;
|
||||
Body._nextNonCollidingGroupId = -1;
|
||||
Body._nextCategory = 0x0001;
|
||||
Common._nextId = 0;
|
||||
|
||||
// reset random seed
|
||||
|
|
|
@ -24,10 +24,9 @@ var Axes = require('../geometry/Axes');
|
|||
(function() {
|
||||
|
||||
Body._inertiaScale = 4;
|
||||
|
||||
var _nextCollidingGroupId = 1,
|
||||
_nextNonCollidingGroupId = -1,
|
||||
_nextCategory = 0x0001;
|
||||
Body._nextCollidingGroupId = 1;
|
||||
Body._nextNonCollidingGroupId = -1;
|
||||
Body._nextCategory = 0x0001;
|
||||
|
||||
/**
|
||||
* Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults.
|
||||
|
@ -100,9 +99,9 @@ var Axes = require('../geometry/Axes');
|
|||
*/
|
||||
Body.nextGroup = function(isNonColliding) {
|
||||
if (isNonColliding)
|
||||
return _nextNonCollidingGroupId--;
|
||||
return Body._nextNonCollidingGroupId--;
|
||||
|
||||
return _nextCollidingGroupId++;
|
||||
return Body._nextCollidingGroupId++;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -112,8 +111,8 @@ var Axes = require('../geometry/Axes');
|
|||
* @return {Number} Unique category bitfield
|
||||
*/
|
||||
Body.nextCategory = function() {
|
||||
_nextCategory = _nextCategory << 1;
|
||||
return _nextCategory;
|
||||
Body._nextCategory = Body._nextCategory << 1;
|
||||
return Body._nextCategory;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue