ParticleSystem - faster animation after each scene.dispose()

Hi,

I have this problem now for few days. The code is basically the same as in playground. Except that in local environment particleSystem speed increases every time button “restart game” is pressed.

Does anybody have an idea why this is happening?

https://playground.babylonjs.com/#PVJ34S

1 Like

Hello and welcome :slight_smile:

I fixed your PG as the scene.dispose was not working because the scene was not a global var:
https://playground.babylonjs.com/#PVJ34S#1

Do you have any error on the console on your local env? Can you make sure the scene.dispose is executed?

Hi and thanks for pushing new git :wink:

Yes scene.dispose() is executed and there’s, no errors in console.

This is basic mind-game, made only for learning purpose, it is “Complete 3D HTML5 Concentration game made with Babylon.js” clone on steroids.

Mine is here.

It is a cool game! love it :slight_smile:
I will need to get a repro somewhere (ideally on the PG) to help further

Most probably it’s because you create a new renderLoop whereas the previous one still exists. In the PG, the renderLoop is setup a single time, but in your local dev, I think each time you restart the game you must call again engine.runRenderLoop?

2 Likes

Perfect, thanks Evgeni.

I tried to add function engine.stopRenderLoop(), but it didn’t help. So I moved engine.runRenderLoop() outside of my init/reinit function and voala…

Thanks to both of you

Cheers