Particle Emitter Problem

Hey,



i want a constant stream of particles, like rain, but it’s not working actually.

When i use “emitAllParticles()”, i can see them but they don’t have the size and lifetime which i’ve setted.



void initRain()

{

_rain = new ParticleEmitter(“rainParticles”, ParticleMesh.Type.Point, 2000);

_rain.setEnabled(true);



_rain.setParticlesPerSec(80f);

_rain.setStartSize(10000f); //not working

_rain.setEndSize(10000f); //not working

_rain.getParticleInfluencer().setInitialVelocity(new Vector3f(0, -1, 0));

_rain.getParticleInfluencer().setVelocityVariation(0.3f);

_rain.setLowLife(10f); //not working

_rain.setHighLife(30f); //not working

_rain.setRotateSpeed(2f);

_rain.setRandomAngle(true);

_rain.setGravity(0, 1, 0);



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

rainMaterial.setTexture(“Texture”, assetManager.loadTexture(“particle/RainDrop.png”));

_rain.setMaterial(rainMaterial);



Vector3f position = cam.getLocation().add(cam.getDirection().normalizeLocal().multLocal(cam.getFrustumNear()));

//position should be in front of the camera

_rain.setLocalTranslation(position.x, position.y , position.z);



_mainScene.attachChild(_rain);

}

Don’t use point mesh, use triangle.



No wonder why .setStartSize(10000f); doesn’t work you’re actually saying that the particle is 10000 world unit wide… try with 0.2f or something like that

same for end size.



lowlife and highlife are the time span in second that your particle may live.

Ah many thanks! Is the point mesh type deprecated? I want to save memory as much as i can; so the best choice would have been point.



One last problem: My particles are drawn with edges. I don’t know what’s wrong, because my RainDrop.png includes an alpha channel.

  1. It’s not deprecated, but i’m not an expert of how to use it, you’ll need someone else’s insight


  2. You have to set the material to blend alpha

I’ve set rainMaterial.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); now, but i still can see the edges.

Ah problem solved. The texture was wrong.