# Parent for particles system

**URL:** <https://forum.babylonjs.com/t/parent-for-particles-system/8054>\
**Category:** Questions\
**Created:** [January 15, 2020, 9:59pm UTC](https://forum.babylonjs.com/t/parent-for-particles-system/8054 "2020-01-15T21:59:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![avin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/avin/32/14454_2.png) [@avin](https://forum.babylonjs.com/u/avin)\
**Post date:** [January 15, 2020, 9:59pm UTC](https://forum.babylonjs.com/t/parent-for-particles-system/8054/1 "2020-01-15T21:59:06Z")

</div>

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” 🤔

---

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [January 15, 2020, 10:22pm UTC](https://forum.babylonjs.com/t/parent-for-particles-system/8054/2 "2020-01-15T22:22:37Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![avin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/avin/32/14454_2.png) [@avin](https://forum.babylonjs.com/u/avin)\
**Post date:** [January 16, 2020, 1:30pm UTC](https://forum.babylonjs.com/t/parent-for-particles-system/8054/3 "2020-01-16T13:30:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [January 16, 2020, 2:16pm UTC](https://forum.babylonjs.com/t/parent-for-particles-system/8054/4 "2020-01-16T14:16:38Z")

</div>

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.

[https://playground.babylonjs.com/#PU4WYI#124](https://playground.babylonjs.com/#PU4WYI#124) 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?)

---

<div class="post-metadata">

**Author:** ![avin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/avin/32/14454_2.png) [@avin](https://forum.babylonjs.com/u/avin)\
**Post date:** [January 16, 2020, 7:53pm UTC](https://forum.babylonjs.com/t/parent-for-particles-system/8054/5 "2020-01-16T19:53:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [January 16, 2020, 10:20pm UTC](https://forum.babylonjs.com/t/parent-for-particles-system/8054/6 "2020-01-16T22:20:56Z")

</div>

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.

[https://playground.babylonjs.com/#PU4WYI#127](https://playground.babylonjs.com/#PU4WYI#127)

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… 🙂 Wide-open prairies for mad scientists. VERY fun.
