mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-24 13:29:01 -05:00
changed Composte.removeComposite and Composte.removeBody to reset body.sleepCounter
This commit is contained in:
parent
6f8a54b253
commit
6d10c3d14e
1 changed files with 10 additions and 0 deletions
|
@ -192,8 +192,15 @@ var Body = require('./Body');
|
|||
*/
|
||||
Composite.removeComposite = function(compositeA, compositeB, deep) {
|
||||
var position = Common.indexOf(compositeA.composites, compositeB);
|
||||
|
||||
if (position !== -1) {
|
||||
var bodies = Composite.allBodies(compositeB);
|
||||
|
||||
Composite.removeCompositeAt(compositeA, position);
|
||||
|
||||
for (var i = 0; i < bodies.length; i++) {
|
||||
bodies[i].sleepCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (deep) {
|
||||
|
@ -244,8 +251,10 @@ var Body = require('./Body');
|
|||
*/
|
||||
Composite.removeBody = function(composite, body, deep) {
|
||||
var position = Common.indexOf(composite.bodies, body);
|
||||
|
||||
if (position !== -1) {
|
||||
Composite.removeBodyAt(composite, position);
|
||||
body.sleepCounter = 0;
|
||||
}
|
||||
|
||||
if (deep) {
|
||||
|
@ -296,6 +305,7 @@ var Body = require('./Body');
|
|||
*/
|
||||
Composite.removeConstraint = function(composite, constraint, deep) {
|
||||
var position = Common.indexOf(composite.constraints, constraint);
|
||||
|
||||
if (position !== -1) {
|
||||
Composite.removeConstraintAt(composite, position);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue