2 problems with ParticleEmmiter in a Voxel Game

I have 2 small problems with ParticleEmmiter in a Voxel Game:

1 - Every time the player breaks a block, a new ParticleEmmiter must be created and attach the rootNode, however, they are not detach rootNode after highLife ends or killAllParticles is called! (I even auditioned with 1,000,000 particles) Which can cause lag.

2 - I have a TextureAtlas 16 x 16, then set up the ParticleEmmiter setX and setY to 16 (size of TextureAtlas), ok, but apparently there is no specific method to set the ImageX position and imageY of block I want!

Ad1) Create a custom controller, attach it to your particle emitter, inside it you need to test the particle emitter status and particles status. Inside that controller’s code you should disconnect the particle emitter from its parent.

Just to clarify, is this atlas for your different types of blocks, and you want your particles to be just that type of block ? … because the emitter doesn’t work that way.

for performance, it may be better to have just one emitter that you move around, rather than create a new object every time.

Already tried that. But if the transmitter release a maximum of 30 particles, by breaking two or more blocks quickly, the amount of particles of the sequential blocks is smaller.

I Guess I’ll have to use separate textures for now instead of TextureAtlas.

I’ve been watching his work in physics particles, is something that I really need now, give me an idea of ​​how to do something?

Have a pool of 5 or so emitters then perhaps :smiley:

Depends how quickly the user can perform this action really.

Have solved the problem, I created a kind of “cache pool” to detach the emitter when their lifetime ends. :smiley:

1 Like