2

Is there any way to scale particle effects at runtime using libGDX's particle system?

I'm aware of this question on the subject, but it doesn't address scaling at runtime. I tried using the answer by Viktor, but it simply made the particle effect disappear all together. Here is the code I tried using:

ParticleEffect pe;

//Scale particle
for(ParticleEmitter emitter : pe.getEmitters())
{
    float scaling = emitter.getScale().getHighMax();
    emitter.getScale().setHigh(scaling * scale);
    scaling = emitter.getScale().getLowMax();
    emitter.getScale().setLow(scaling * scale);
    scaling = emitter.getVelocity().getHighMax();
    emitter.getVelocity().setHigh(scaling * scale);
    scaling = emitter.getVelocity().getLowMax();
    emitter.getVelocity().setLow(scaling * scale);
}

pe.setPosition(x, y);
pe.draw(spriteBatch, delta);

Without the scaling code in the middle of that, it renders fine, just not scaled.

Community
  • 1
  • 1
kabb
  • 2,474
  • 2
  • 17
  • 24
  • Here is an answer that may help you: http://stackoverflow.com/questions/14839648/libgdx-particleeffect-rotation – asutrane Jun 19 '14 at 16:48

1 Answers1

7

Maybe it's too late... but if someone needs this :

particleEffect.scaleEffect( scale factor);

Yof
  • 86
  • 1
  • 2