Real-Time Particle Effects

Hello. I am using .ptf files for particles and their effects. Hoping to make dynamic changes to particles, but it is unclear how to do this when the .ptf file appears static.

For example; I want to change the color of particles as time progresses, yet I create the particle renderer in the .ptf file and do not know how to access this node from my python code that runs the world.

The ptf code is run in the context of the ParticleEffect object that loads it; so any reference you see to “self” within the ptf code is actually a reference to your ParticleEffect object. So, where you see the ptf file calling self.addParticles(p0), you can look at ParticleEffect.addParticles(), and see that it is adding the particle object to self.particlesDict.

Thus, you can iterate through the particles in a particular ParticleEffect by walking through ParticleEffect.particlesDict.

David