mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-30 10:20:52 -05:00
fix issue with removed bodies causing collisions
This commit is contained in:
parent
cec294d9c3
commit
23a773ae88
1 changed files with 5 additions and 4 deletions
|
@ -160,6 +160,11 @@ var Body = require('../body/Body');
|
||||||
broadphasePairs = allBodies;
|
broadphasePairs = allBodies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear all composite modified flags
|
||||||
|
if (world.isModified) {
|
||||||
|
Composite.setModified(world, false, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
// narrowphase pass: find actual collisions, then create or update collision pairs
|
// narrowphase pass: find actual collisions, then create or update collision pairs
|
||||||
var collisions = broadphase.detector(broadphasePairs, engine);
|
var collisions = broadphase.detector(broadphasePairs, engine);
|
||||||
|
|
||||||
|
@ -205,10 +210,6 @@ var Body = require('../body/Body');
|
||||||
// clear force buffers
|
// clear force buffers
|
||||||
_bodiesClearForces(allBodies);
|
_bodiesClearForces(allBodies);
|
||||||
|
|
||||||
// clear all composite modified flags
|
|
||||||
if (world.isModified)
|
|
||||||
Composite.setModified(world, false, false, true);
|
|
||||||
|
|
||||||
Events.trigger(engine, 'afterUpdate', event);
|
Events.trigger(engine, 'afterUpdate', event);
|
||||||
|
|
||||||
return engine;
|
return engine;
|
||||||
|
|
Loading…
Reference in a new issue