diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 385172ee2c..877b5ed931 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2489,19 +2489,20 @@ void Application::update(float deltaTime) { _entitySimulation.unlock(); avatarManager->handleOutgoingChanges(_physicsEngine.getOutgoingChanges()); - avatarManager->handleCollisionEvents(_physicsEngine.getCollisionEvents()); + auto collisionEvents = _physicsEngine.getCollisionEvents(); + avatarManager->handleCollisionEvents(collisionEvents); _physicsEngine.dumpStatsIfNecessary(); - } - } - if (!_aboutToQuit) { - PerformanceTimer perfTimer("entities"); - // Collision events (and their scripts) must not be handled when we're locked, above. (That would risk deadlock.) - _entitySimulation.handleCollisionEvents(_physicsEngine.getCollisionEvents()); - // NOTE: the _entities.update() call below will wait for lock - // and will simulate entity motion (the EntityTree has been given an EntitySimulation). - _entities.update(); // update the models... + if (!_aboutToQuit) { + PerformanceTimer perfTimer("entities"); + // Collision events (and their scripts) must not be handled when we're locked, above. (That would risk deadlock.) + _entitySimulation.handleCollisionEvents(collisionEvents); + // NOTE: the _entities.update() call below will wait for lock + // and will simulate entity motion (the EntityTree has been given an EntitySimulation). + _entities.update(); // update the models... + } + } } {