From 23a773ae889c389a3021e689e8c53c092a057087 Mon Sep 17 00:00:00 2001 From: liabru Date: Sat, 9 Apr 2016 20:10:35 +0100 Subject: [PATCH] fix issue with removed bodies causing collisions --- src/core/Engine.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/Engine.js b/src/core/Engine.js index 33e76b2b..b549f663 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;