Particle Emitter is looping over sprite sheet too fast

I am trying to use particle emitter to loop over a sprite sheet. But the particle emitter is looping over the sprite sheet too fast. How can I slow it down?

This is the following test case,

import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;

public class TestCase extends SimpleApplication {
    public static void main(String[] args) {
        TestCase app = new TestCase();
        app.showSettings = false;
    public void simpleInitApp() {
        ParticleEmitter particleEmitter;
        particleEmitter = new ParticleEmitter("Particle Emitter", ParticleMesh.Type.Triangle, 36);

        Material particleMaterial = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
        particleMaterial.setTexture("Texture", assetManager.loadTexture("butterfly_fly_1.png"));






Here is the sprite sheet,

And here is my output,

particleEmitter.setParticlesPerSec(.5f); does the trick.

It’s still not smooth enough. Also since the butterfly isn’t filling up the entire sprite sheet, I get small breaks at the end.

Try setting the framerate. I’ve been using if for so long, i’ve never seen anything like this.


Oh, and, Oooo. Pretty.

1 Like

Thanks, that improved the situation. But is it desirable behavior? Shouldn’t setParticlesPerSec be somehow tied with tpf?

Also, what could be the reason of the white flash on the at the end of the animation?

I am using the following modified sprite sheet. I added the last two sprite to complete the 12x3 sprite sheet, but the modification should not cause the white flash?

I think this an unusual use of the particleEmitter. Fire just burns - rotating through a few frames. I didn’t find a way to slow it down (other that what I said before. I’m glad it’s working.) You might write your own animator that uses fps.

I think the white is your desktop, being recorded by the gif-recorder? Just a thought.

I did a shader to animate over a spritesheet. The code in the linked post is updated I think. But I guess your particle emitter is doing much the same thing :slight_smile:

1 Like

The particle emitter doesn’t support any speed setting…
Though I usually make my own shader for animated materials like this
Here is what I used in one of my android games:

The interesting code occurs in the vert shader. The frag one is very basic, it’s just a texture fetch. If you want more fancy stuff like lighting you’ll have to add it there.
You can consider this BSD license and use it wherever you want.


I offer you to try t0neg0d particle emitter :slight_smile: