Um… particleSystems can be created and started without an .emitter (or with .emitter = null)… IF it also has .emitRate=0.
In this PG, fountain is gone, but 5 cards were made. In lines 44-94, I do that particleSystem with .emitter = null and .emitRate = 0… and I start() it. It does nothing, of course.
Look at lines 110-112. All we do if top button is pressed… is set an .emitRate = 1500. Easy, huh?
Look at lines 125-127. If bottom button is pressed… set an .emitRate = 0.
Now, for the fancy part. FIVE emitters… operating all at the same time… on a single particleSystem.
Line 129 starts it, and is where YOU will put the cards that YOU want to be on-fire.
Line 131… puts some code on the renderLoop… a switch/case statement that simply keeps changing WHICH card… is doing the emitting. Pretty nice, huh?
Lines 54-55… are kind of important. Each card is 7 units tall and 5 units wide. Let’s bring it into the post, here…
particleSystem.minEmitBox = new BABYLON.Vector3(-2.5, 3, 0);
particleSystem.maxEmitBox = new BABYLON.Vector3(2.5, 3.5, 0);
These lines tell us WHERE (in localSpace for each card)… the particles will be emitted-from. Since you showed us cool pictures, I knew that you wanted flames coming from the tops of the cards.
Can you see that our “emitBox” (emit area) is from -2.5X (left edge of card)… to +2.5X (right edge of card). You also might notice that the bottom of the emit-area… is 3Y units above card center, and top edge is 3.5Y above card center.
To be brief and blunt, the particleSystem’s “emit box” is the top-most 1/14th of the card. (The top .5 unit area of the card). We could have done something similar with the original fountain box. Using min/max emit box… we could have set the particles to only emit from one corner area of the box. Emitbox generally means… WHERE upon the emitter… should the particles be emitted-from.
Lines 80/81 were also adjusted. There is a “1” in both Y values, so that means I want the particles to MOSTLY shoot “upward”… but the -.1 and +.1 in the X values… means the spray gets slightly wider in X-width… as they travel thru space. Since this is a “flat” scene, I set both Z values = 0, so the particles have no “spread” on the Z axis. Look at the cards particle spraying from the side… you will see that the particles spray “flat”, z-depth-wise. Hard to explain, easy to experiment-with. Those vector3’s are called “direction vectors”… not at all like the “position vectors” we used on the emitBox values.
Ok, let’s let all that soak-in, and wait for questions from you, if you have some. I bet you didn’t expect that a single particle system could have 5 emitters, did you? The first time I saw it done… I was pretty amazed, myself.
And we’re ONLY using a 1500 emitRate in line 111. Crank that to 5000, and they REALLY REALLY spray from all 5 cards. Too fun. BJS particles are high-performance, for sure. Now for some flame colors, and you’re ON FIRE!
Remember those -2.5 and +2.5 values in lines 54/55? You are allowed to make them -3.5 and +3.5 or any other values… for a spraying emit-area that is wider than the card. In other words… emitBox numbers don’t HAVE-TO fit onto the card. The emitbox could be -20 and +20 X values… 8 times wider than the width of the card. No problems.
But if I were you, I wouldn’t go wider than -3.5 and +3.5 … 2 units wider than the card. That will fill-in the gaps between the cards. Setting those -.1 and +.1 values in lines 80/81… to -.3 and +.3… would also fill-in the gaps between cards… by letting the particleSystem spray-volume… spread wider during flight.
Ok, I hope I have been helpful. Start the particleSystem in a 0 emitRate “mode” (sort of idling)… and then get out the pliers, and start twisting its knobs. TOO FUN!