diff options
-rw-r--r-- | src/index.js | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/index.js b/src/index.js index 059ba68..67e6087 100644 --- a/src/index.js +++ b/src/index.js @@ -62,10 +62,9 @@ RAPIER.init().then(() => { let score = 0; let highScore = score; let lastScoredAt = performance.now(); + const eventQueue = new RAPIER.EventQueue(true); let mainLoop = () => { - let eventQueue = new RAPIER.EventQueue(true); - world.step(eventQueue); eventQueue.drainCollisionEvents((handle1, handle2, started) => { @@ -119,8 +118,6 @@ RAPIER.init().then(() => { objElement.style.width = `${objSize.x}px`; objElement.style.height = `${objSize.y}px`; - eventQueue.free(); - setTimeout(mainLoop, STEP_MS); }; |