diff --git a/src/core/Engine.js b/src/core/Engine.js index 33e76b2..b549f66 100644 --- a/src/core/Engine.js +++ b/src/core/Engine.js @@ -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;