Particle Emitter on guiNode

Hello,

I’m trying to a add snow effect to the game I’m working on. I’ve got the particle emitter working, but it only seems to be visible when attached to the root node. When I try to position it at the top of the screen using the guiNode, nothing shows up.

I’ve tried to vary the shape and size of the emitter and of the particles, but the problem remains.

My goal is to have the emitter to always be on top of the camera.

Any suggestion on how to fix this issue?



[java]

ParticleEmitter snow = new ParticleEmitter(“snow”, ParticleMesh.Type.Triangle, 10);

Material snow_mat = new Material(assetManager, “Common/MatDefs/Misc/Particle.j3md”);

snow.setShape(new EmitterBoxShape(new Vector3f(-settings.getWidth()/2,0f,0f),new Vector3f(settings.getWidth()/2,0f,0f))); //Particle emmiter is a line

snow_mat.setTexture(“Texture”, assetManager.loadTexture(“Textures/star.png”));

snow.setMaterial(snow_mat);

snow.setImagesX(1); snow.setImagesY(1); // 1x1 texture animation

snow.setRotateSpeed(4);

snow.setSelectRandomImage(true);

snow.setInitialVelocity(new Vector3f(0, 4, 0));

snow.setStartColor(new ColorRGBA(1f, 1f, 1f, 1f));

snow.setGravity(6f);

snow.setVelocityVariation(.60f);

snow.setLocalTranslation(settings.getWidth()/2,settings.getHeight(),0f); //Top middle

guiNode.attachChild(snow);

snow.emitAllParticles();

[/java]

If this doesn’t work, I guess you’ll have to make it in the rootNode and have it follow the camera :frowning:

What do you mean by “on top of the camera”? Do you just want them always visible, but in 3D?



The gui node is in ortho projeciton (ie screen coordinates), so unless the particle emitter is set up to spawn particles in 2D space and constrained to fit in the screen dimensions, you probably won’t see any particles.

The snow particles don’t need to be in 3D, I simply want them to display on the HUD.

My problem is exactly what you stated, I can’t seem to set up the emitter to spawn particles in 2D space and constrain it to fit in the screen dimensions.

Is there a general way to make a 2d emitter which will display on the HUD?

1 Like