0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-24 13:29:01 -05:00

revert engine collisionStart event back to before resolve

This commit is contained in:
liabru 2023-02-15 21:27:39 +00:00
parent b81d6e6d7f
commit 4443e6dd99

View file

@ -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 });