how to share a particle effect on serveral nodes ?

I find that it is quite processing intensity to render a ParticleEffect object. If I have a scene, say a firework, I create one ParticleEffect and want to use it on several nodepaths (may be with different scale also). How can I do that ?

The ParticleEffect.start() can only work on one node at a time. Is it possible to share it, or any other tricks can do it ?

Also, what is the meaning of the following API of ParticleEffect ?
def start(self, parent=None, renderParent=None)
what is the different between parent and renderParent
def softStop(self)
def softStart(self)

The parent node is the parent of the overall ParticleEffect, and it determines the coordinate space that the particles are generated in. The renderParent is the parent under which the generated particles are actually rendered in, and also determines the coordinate space that the particles live in once generated.

Usually these are set to be the same NodePath (you can do this by passing None in for renderParent, or by simply passing only one parameter to start()). But there are certain particle effects for which they should be different. For instance, imagine the smokestack of a moving train. The smoke is generated in the coordinate system of the moving train (the origin of the smokestack moves along with the train). But once generated, the smoke particles exist in the coordinate system of the world (the smoke stack trails behind the train as it moves on). So, for this system, you would set the parent to the train, and the renderParent to the world.

To answer your first question, use instancing. Simply instance your parent (or renderParent, if you have one) to the different places you want the smoke to appear. Use parent.instanceTo(newLocation).

David

Hi!
I wish to create a fire effect in front of a meteor by using fire particle effect.

But the problem is that the fire doesn’t move ‘with’ the meteor. It is just stuck at one place.

I have added the important parts of code here. Please help. :slight_smile:

self.meteor = Actor("models/more/meteor/meteorshower",{"mshower": "models/more/meteor/meteorshower"})
self.meteor.setScale(0.05)
self.meteor.setPos(12,-50,34)
self.meteor.reparentTo(render)
self.meteor.loop("mshower")
		
base.enableParticles()
self.fire = ParticleEffect()
self.loadParticleConfig1('fireish.ptf')


def loadParticleConfig1(self, file):
        self.fire.cleanup()
        self.fire = ParticleEffect()
        self.fire.loadConfig(Filename(file))        
        self.fire.start(parent=self.meteor) 
        self.fire.setPos(0)	

The meteor is an Actor. That means it’s not the meteor itself that’s moving due to its own animation, it’s one of its joints.

So, you’ll need to find and expose the appropriate joint (as shown in the “looking and gripping” example), and use that as the particle parent, instead of the meteor topnode.

David