Wow! ExportSet-included particleSystems… DO carry-along their custom startPosition, startDirection, and update functions! COOOOOOOL!
In other words… umm… aw hell, I’ll use a playground:
https://playground.babylonjs.com/indexStable.html#1PQT7P#21
Lines 84-86 show that ps1 uses 3 custom functions.
In line 132, I create (export) a particleSet called mySet, and dump its systems[0] to console in line 133.
You can drill the particleSet object yourself, but most important… lines 134-136 prove that our three custom functions… ARE included in the particleSet, and would travel-along fine WITH the particleSet. NICE!
Let’s take a look at one more thing… in the #21 playground. Look at lines 20-34, where two of my custom funcs are located. Notice that I call a ‘helper function’ called randomNumber()… often (line 61).
This function will NOT travel-along-with (be included-in) the exported mySet particleSet, because it is not a ‘member’ of particleSystem ps1.
So, let’s MAKE IT be a member of ps1, and see what happens.
https://playground.babylonjs.com/indexStable.html#1PQT7P#22
Lines 72-80… we wait for ps1 to be created, and then add ps1.randomNumber function as a member.
Lines 20-34… we change all occurrences of randomNumber… to this.randomNumber.
Line 138 now proves that ps1.randomNumber is being included in mySet, and all is working perfectly.
Let’s take it a step further. This “overloading” of the particleSystem(s) that are included within particleSets… can have other handy uses. pg #23
In PG #23, I have added ANOTHER ps1 overload property at line 82 - ps1.info. Line 141 proves that the overload property is included in the mySet export. Sweet, huh? Yep!
BabylonJS has THE BEST cool-system inventors ANYWHERE, for sure! You guys ROCK!
BIG WARNING: I MIGHT be a fool. I might be examining a “ref” to ps1… when I do those console.log tests. IF that is the case, I am wrong about everything I have said… so far. In other words… when I do the console.logs of various ps1 properties, I might be examining the ACTUAL ps1 that resides in memory, and NOT the ps1 values that reside within the particleSet. (Wingy crosses fingers.) I am still quite inexperienced with the object inspector in my Firefox ESR (no Firebug).
I fear this IS the case, and that particleSets currently do not ‘honor’ custom particle funcs or property overloads. But hey, that’s why I’m talking. Experts are nearby… they’ll set me straight or teach me about future possibilities/plans to honor custom funcs within particleSets.
Readers are already thinking about the “tornado” particleSet, aren’t you? In other threads, we have been speaking about path3d’s. A tornado is NOT a simple cone emitter. Tornadoes do snake-like belly-dancer bends and swerves… which might dictate that a vertical path3D is used in the center of the effect, and the path is deformed from time-to-time.
Swarming. Weighted particles. Not an easy particle-emission rig/armature. The tornado will require a custom update function like nobody has EVER seen before.
Party on! Sorry for the long-winded yapping.