Particle and setTexture problem

Hi guys!
I found a really strange behaviour with swapping textures and using particles on the same model.

base.enableParticles()

model = loader.loadModel('box')
model.reparentTo(render)
tex = loader.loadTexture('maps/envir-reeds.png')
model.setTexture(tex, 1)

particle = ParticleEffect()
particle.loadConfig(Filename('/home/boss/particles/test2.ptf'))
particle.start(model)

When I load a model and dynamicly swap the texture the particle which starts takes the same texture for its own purposes. So the result is correct swapped texture on the model, but instead the particle to use its texture in the ptf - p0.renderer.setTexture(loader.loadTexture(’/home/boss/particles/fire.png’)) it took the new texture from the model.
Anyone knows why it makes it ?

You are parenting the particle effect directly to the model node, and therefore the particle node inherits all of the properties you applied to the model node. This includes the texture override.

If you don’t want that behavior, but you want the particle effect to follow the transform of the model, then use an intervening node instead, something like this:

handle = render.attachNewNode('handle')

model = loader.loadModel('box')
model.reparentTo(handle)
tex = loader.loadTexture('maps/envir-reeds.png')
model.setTexture(tex, 1)

particle = ParticleEffect()
particle.loadConfig(Filename('/home/boss/particles/test2.ptf'))
particle.start(handle)

So you see, both the particle effect and the model are parented to the same node, handle. Now when you want to move the model and the particle effect together, move the handle node, not the model node.

David

Thanks alot it worked.