Skip to content

Commit

Permalink
fix issue with removed bodies causing collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Apr 9, 2016
1 parent cec294d commit 23a773a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/Engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 23a773a

Please sign in to comment.