From 4443e6dd998af7718545d15e31b03656a690120e Mon Sep 17 00:00:00 2001 From: liabru Date: Wed, 15 Feb 2023 21:27:39 +0000 Subject: [PATCH] revert engine collisionStart event back to before resolve --- src/core/Engine.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/Engine.js b/src/core/Engine.js index 2378074..f4d5c41 100644 --- a/src/core/Engine.js +++ b/src/core/Engine.js @@ -146,6 +146,10 @@ var Body = require('../body/Body'); if (engine.enableSleeping) Sleeping.afterCollisions(pairs.list); + // trigger collision events + if (pairs.collisionStart.length > 0) + Events.trigger(engine, 'collisionStart', { pairs: pairs.collisionStart }); + // iteratively resolve position between collisions var positionDamping = Common.clamp(20 / engine.positionIterations, 0, 1); @@ -172,9 +176,6 @@ var Body = require('../body/Body'); Engine._bodiesUpdateVelocities(allBodies); // trigger collision events - if (pairs.collisionStart.length > 0) - Events.trigger(engine, 'collisionStart', { pairs: pairs.collisionStart }); - if (pairs.collisionActive.length > 0) Events.trigger(engine, 'collisionActive', { pairs: pairs.collisionActive });