mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
changed engine collisionStart event to trigger after resolving and after updating body velocities
This commit is contained in:
parent
d52f7e6dcf
commit
70600a8c11
1 changed files with 3 additions and 4 deletions
|
@ -147,10 +147,6 @@ var Body = require('../body/Body');
|
|||
if (engine.enableSleeping)
|
||||
Sleeping.afterCollisions(pairs.list, delta);
|
||||
|
||||
// trigger collision events
|
||||
if (pairs.collisionStart.length > 0)
|
||||
Events.trigger(engine, 'collisionStart', { pairs: pairs.collisionStart });
|
||||
|
||||
// iteratively resolve position between collisions
|
||||
Resolver.preSolvePosition(pairs.list);
|
||||
for (i = 0; i < engine.positionIterations; i++) {
|
||||
|
@ -175,6 +171,9 @@ 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 });
|
||||
|
||||
|
|
Loading…
Reference in a new issue