Parent for particles system

Hey guys! Dou you know? is it possible to use parent for particles system. I need to have rotation as in parent node in “sync” :thinking:

Hi Avin. ParticleSystem.emitter can be a mesh or a vector3.

If you make it a (invisible) mesh, that mesh can be parented to another node.

So, the ParticleSystem isn’t parented, but the most-important part of it… is. :slight_smile:


@Wingnut thank you, then i’ll just try to sync gravity with mesh rotation.

1 Like

My pleasure. Often, when an emitter is moving, it is best to set particleSystem min/max emit power… to low values. That way, the particles are sort-of “left-behind” and not really “shot-out”. Good for rockets/missiles. Notice low values in lines 53/54. But you don’t want to set them to zeroes, or else your direction1/direction2 emit angles… won’t work well (low/bad spread).

Keep in mind that a particleSystem can have ITS OWN .gravity, and doesn’t have-to use scene.gravity. Scene.gravity and particleSystem(s).gravity… can be different values.

Also, remember that MANY particleSystems can be activated at the same time, and they can share emitters. Great for fire, smoke, soot, ice-crystals… all coming from the very same thruster port.

AND… in the renderLoop or with a setInterval… you can change ps.emitter WHILE the particle system is emitting. (perhaps a circular ring of emitters, all fed from the same ps, by switching to NEXT EMITTER every renderLoop frame?)

1 Like

@Wingnut, your example very well suited for my case. Thanks again for your help!

1 Like

Emitter can be worldspace vector3, too. SO, emitter = different vector3 position… each interval or renderLoop. The beginnings of on-the-fly programatic-control of the PS.

Math.sin and Math.cos, when applied to vector3 positions… are great at plotting “orbits”.

In line 56, we start with a vector3-type emitter… at worldspace 0,0,0.

Line 74… we “insert” a function into our onBeforeRenderObserverable system, which means it runs every rendering. The value alpha is a constantly incremented value. Lines 75-77… we are totally abusing emitter’s x/y/z values… flying that puppy. FUN!

Line 78… let’s change the Y-gravity (sinusoidally) with some math, too! Totally demented and… FUN!

Line 79… hey, we’re inside the render loop… let’s set ps.color1 to a random value… get some tooty frooty colors. Setting color2 and colorDead properties in the renderLoop… not recommended… causes a flickering.

Yeah, once you get that onBeforeRender “engine” activated… you can use it to do all sorts of crazy things to the particleSystem… WHILE it runs.

So… a single particleSystem… can have constantly-program-adjusted emitters, directions, powers, colors, lifetimes, sizes, and and and… :slight_smile: Wide-open prairies for mad scientists. VERY fun.

1 Like