Using ParticleInterval?

Hi, another day another puzzle. I’m trying to use ParticleInterval’s but I don’t see the particles when I start the interval. doing a isPlaying() tells me that the interval is playing but nothing appears on the screen. Here is the code I have so far:

particleEffect = m.pEffect
pI = ParticleInterval(particleEffect, render)
print pI.isPlaying()

I tried doing the same thing with the teapot particle demo but nothing happens there either. Am I missing some args or an essential step to using ParticleIntervals? Thanks.

Have you called base.enableParticles()? This needs to be called once, usually at startup, in order to enable the particle system.


Yup, I’ve done that. Particles work fine when started the normal way but I want to slow down the particles like in this topic.

I really can’t figure out how to make this work, I don’t have any examples to see so irunno. Here’s the full code for the module:

import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from direct.task.Task import Task
from import Actor
from pandac.PandaModules import NodePath
from pandac.PandaModules import OrthographicLens
from direct.interval.ParticleInterval import ParticleInterval
from direct.interval.IntervalGlobal import *
from pandac.PandaModules import CardMaker

from MudParticles import *

class MudSimulator(DirectObject):
	def __init__(self):
		"""Draws an offscreen buffer for texturing the mudflow"""
		# Offscreen buffer stuff
		self.altBuffer=mainWindow.makeTextureBuffer("hello", 512, 512)
		self.altRender=NodePath("new render")
		# Camera stuff
		lens = OrthographicLens()
		lens.setFilmSize(20, 15)
		# Makes the full screen card
		cm = CardMaker('background')
		# Try to pull the texture from the model to save memory
		if __name__ is not "__main__":
			cardTexture = loader.loadTexture("models/mayon_map.PNG")
			cardTexture = render.find_texture("mayon_map.PNG")
		self.card = self.altRender.attachNewNode(cm.generate())
		# Particles and intervals should correspond to each others index
		self.mudParticleList = []
		self.mudIntervalList = []
	def loadParticle(self, mudType):
		if mudType == "top":
			m = MudTop()
			#print "OLO", type(m)
		particle = self.mudParticleList[-1].pEffect
		# These lines are giving me a problem
		pI = ParticleInterval(particle, self.card, name="Particlwhat", worldRelative="0", renderParent=self.altRender)
		pI.start() # Not really working
		print "Is particle playing?", pI.isPlaying()
		# The lines below work, showing the particles

class World(DirectObject):
	def __init__(self):
		mudSim = MudSimulator()
		base.bufferViewer.setCardSize(1.4, 0.0)

if __name__ == "__main__":
	w = World()

Can anyone see where I’m going wrong?

Note that worldRelative=“0” is really the same thing as worldRelative=1, since the string “0” evaluates True by Python. If you wanted to turn off the worldRelative feature, you should remove the quotation marks: worldRelative=0.

Not sure if this is your problem or not.


I spotted the quotation marks as not being necessary but it still wouldn’t run for me. I’ve given up on ParticleIntervals for now, I got the thing done using LerpFunc’s instead. Not quite the effect I was going for but time was short on my project.

I’ll try it out again later on the steam example though.