Slowly showing a low lying fog by animating position of emitter

Based of this awesome answer I am trying to get a low lying fog to smoothly move up above the ground. I can’t yet get it to move with the emitter and I suspect it’s a complex intersection of settings like emitBox, minLifeTime, etc:

https://www.babylonjs-playground.com/#BHNVUE#58 :grin:

If you disable the particleSystem.manualEmitCount and the particleSystem.minLifeTime then it “works” but not smoothly: https://www.babylonjs-playground.com/#BHNVUE#59

Of course I am open to other ways of achieving this, such as animating the opacity / visibility of the fog :slightly_smiling_face:

1 Like

Hi! What about having a positive gravity? Low Lying Fog | Babylon.js Playground (babylonjs-playground.com) :slight_smile:

Nice idea! I tried putting a setTimeout that, after a second, sets the gravity to 0. But it looks like the particles still have some momentum as shown by this: https://www.babylonjs-playground.com/#BHNVUE#61

I’ve also tried expertimenting with particleSystem.reset and particleSystem.rebuild but can’t get them to work.

It’s a bit hacky but this is a first pass that both moves the fog upwards and increases it’s opacity using a custom updateFunction: https://www.babylonjs-playground.com/#BHNVUE#62

NOTE: this does not seem to work for GPUParticleSystem. Which makes sense.

1 Like