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

optimised Pairs.removeOld

This commit is contained in:
liabru 2021-04-26 23:54:48 +01:00
parent 1073ddeecf
commit a882a74cd5

View file

@ -111,6 +111,7 @@ var Common = require('../core/Common');
var pairsList = pairs.list,
pairsTable = pairs.table,
indexesToRemove = [],
pairMaxIdleLife = Pairs._pairMaxIdleLife,
pair,
collision,
pairIndex,
@ -127,7 +128,7 @@ var Common = require('../core/Common');
}
// if pair is inactive for too long, mark it to be removed
if (timestamp - pair.timeUpdated > Pairs._pairMaxIdleLife) {
if (timestamp - pair.timeUpdated > pairMaxIdleLife) {
indexesToRemove.push(i);
}
}