Effects in GUI

Hi,
im working on an Android game and i want some particle effects in front of the camera.
Each time the user is wiping above the screen, some effects should follow his fingers.

Ive

  1. tried to attach it on the guiNode but I dont get it work (the particles didnt appear)
  2. tried to attach an Node to the cameraNode ( thats complicated because of the diffrent screen widths)

any ideas how i get that running

Likely you are not seeing the particles due to size.

Try setting up the emitter using pixels size instead of world units.

i.e. 1 world unit = 1 pixel in the gui node.

Hmm i dont get it 8-O
how can i switch to pixel size ?

Ive tried that code

[java]
guiNode.detachAllChildren();

        ParticleEmitter fire =
                new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 30);
        Material mat_red = new Material(assetManager,
                "Common/MatDefs/Misc/Particle.j3md");
        mat_red.setTexture("Texture", assetManager.loadTexture(
                "Effects/Explosion/flame.png"));
        fire.setMaterial(mat_red);
        fire.setImagesX(2);
        fire.setImagesY(2); // 2x2 texture animation
        fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f));   // red
        fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
        fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 2, 0));
        fire.setStartSize(1.5f);
        fire.setEndSize(10f);
        fire.setGravity(0, 1, 0);
        fire.setLowLife(1f);
        fire.setHighLife(3f);
        fire.setLocalTranslation(settings.getWidth() / 2, settings.getHeight() / 2, 0);
        fire.getParticleInfluencer().setVelocityVariation(0.3f);
        fire.setLocalScale(20);
        
        AmbientLight al = new AmbientLight();
        al.setColor(ColorRGBA.White.mult(1.3f));
        guiNode.addLight(al);

        guiNode.attachChild(fire);

[/java]

thanks

@coolies said: Hmm i dont get it 8-O how can i switch to pixel size ?

Ive tried that code

[java]
guiNode.detachAllChildren();

        ParticleEmitter fire =
                new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 30);
        Material mat_red = new Material(assetManager,
                "Common/MatDefs/Misc/Particle.j3md");
        mat_red.setTexture("Texture", assetManager.loadTexture(
                "Effects/Explosion/flame.png"));
        fire.setMaterial(mat_red);
        fire.setImagesX(2);
        fire.setImagesY(2); // 2x2 texture animation
        fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f));   // red
        fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
        fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 2, 0));
        fire.setStartSize(1.5f); //<= start with 1, 5 pixel
        fire.setEndSize(10f); // <= end with 10 pixel  => really small in gui node...you may have 1920 pixels ^^
        fire.setGravity(0, 1, 0);
        fire.setLowLife(1f);
        fire.setHighLife(3f);
        fire.setLocalTranslation(settings.getWidth() / 2, settings.getHeight() / 2, 0); // be carefull in gui node 0,0 is at the bottom left corner
        fire.getParticleInfluencer().setVelocityVariation(0.3f);
        fire.setLocalScale(20);// i think you should remove it
        
        AmbientLight al = new AmbientLight();
        al.setColor(ColorRGBA.White.mult(1.3f));
        guiNode.addLight(al); // no needs to add lights in the gui node, plus particle material doesn't handle lightning ^^

        guiNode.attachChild(fire);

[/java]

thanks

also you never do fire.setParticlesPerSecond() (not sure what it defaults to)

@icamefromspace said: also you never do fire.setParticlesPerSecond() (not sure what it defaults to)

Right. It should be 0 at default.

Or emitAllParticles(); when you fire off the effect.

it worked, thanks