0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-23 09:26:51 -05:00

fix issue with removed bodies causing collisions

This commit is contained in:
liabru 2016-04-09 20:10:35 +01:00
parent cec294d9c3
commit 23a773ae88

View file

@ -160,6 +160,11 @@ var Body = require('../body/Body');
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
var collisions = broadphase.detector(broadphasePairs, engine);
@ -205,10 +210,6 @@ var Body = require('../body/Body');
// clear force buffers
_bodiesClearForces(allBodies);
// clear all composite modified flags
if (world.isModified)
Composite.setModified(world, false, false, true);
Events.trigger(engine, 'afterUpdate', event);
return engine;