The Panda3D engine uses text files for storing particle configurations, which are usually created with the Particle Panel. Before being able to use particles, you'll need to tell Panda3D to enable particles:
This function tells Panda3D to enable its built-in physics engine which is also used by particles.
To be able to create ParticleEffect objects, you'll need this import:
from direct.particles.ParticleEffect import ParticleEffect
Next, create a ParticleEffect object and tell it to use a particle configuration file.
p = ParticleEffect()
To start the ParticleEffect, do this:
p.start(parent = render, renderParent = render)
start() takes two arguments:
parent is the node the particles will be "birth-relative" to.
renderParent is the node level the particles will be rendered at. If you want your particles to spawn from your node, but not follow it around, set
renderParent to something else like
ParticleEffect inherits from NodePath, so you can use NodePath methods like
setPos() on it.
To reset the ParticleEffect, use:
To stop the ParticleEffect, use:
To completely remove the ParticleEffect, use:
disable() internally, so you don't need to call it yourself before calling
loadConfig(), you can use
saveConfig() to save the ParticleEffect to a particle configuration file (*.ptf):