matter-js
matter-js copied to clipboard
When slowing down the engine, bodies gain upward momentum out of nowhere.
I am making a game where you can enter slow-motion. At first, I used engine.timing.timeScale
, which worked until I noticed the geometries floating upwards slightly before settling whenever I changed it.
I thought this was a side effect, that I would also make the calculations go slower, so I tried to counter it with this:
engine.constraintIterations = Math.round(2 / simulation_settings.timeMultiplier);
engine.positionIterations = Math.round(6 / simulation_settings.timeMultiplier);
engine.velocityIterations = Math.round(4 / simulation_settings.timeMultiplier);
It didn't help. Is there a reason my geometries gain momentum when I slow the simulation down? How can I fix it?
Try out this experimental branch which improves timing issues and hopefully is more stable for this kind of effect:
https://github.com/liabru/matter-js/pull/777