@nehon
I did take @normen 's advice and try started mostly from scratch, keeping the classes that were pointless to rewrite (Particle related classes and the Particle class itself)
The ParticleEmitter is no longer a Geometry, it’s a Control… and it’self the only control…
Particles are not individual controls anymore.
Initializing and using an emitter is really simple now:
To get one running you only need these 4 lines of code:
[java]
ParticleEmitter p = new ParticleEmitter(“Emitter”, assetManager, ParticleMesh.Type.Triangle, 18000);
p.setSprite(“Textures/emittersprite.png”, 64,64);
someModel.setControl§;
someModel.attachChild(p.getNode()); // or whereever you want to add it.
[/java]
Alternatively, you can use a static mesh that is not added to the scene as a non-animated emitter shape. For more extensive control over the emitter, it looks sorta like this:
[java]
// Set up the basic emitter params
ParticleEmitter p = new ParticleEmitter(“Emitter”, assetManager, ParticleMesh.Type.Triangle, 18000);
p.setSprite(“Textures/emittersprite.png”, 64,64);
p.setEmissionsPerSecond(400);
p.setParticlesPerEmission(10); // This is also calculated when an emission takes place, adding/subtracting to the count to ensure the right number of particles are being emitted. It allows the emitter to emit more particles than what your FPS would allow like in the current version
p.setForceMinMax(.35f,.75f);
p.setLifeMinMax(3f,.5f);
// Retrieve and modify specific influencers
((GravityInfluencer)p.getInfluencer(“Gravity”)).setGravity(0,2,0);
((ColorInfluencer)p.getInfluencer(“Color”)).setStartColor(new ColorRGBA(.4f,.4f,1f,1f));
((ColorInfluencer)p.getInfluencer(“Color”)).setEndColor(new ColorRGBA(1,1,1,0.2f));
((SizeInfluencer)p.getInfluencer(“Size”)).setStartSize(.15f);
((SizeInfluencer)p.getInfluencer(“Size”)).setEndSize(.05f);
((ImpulseInfluencer)p.getInfluencer(“Impulse”)).setEnabled(true);
((PreferredDirectionInfluencer)p.getInfluencer(“PreferredDirection”)).setPreferredDirection(new Vector3f(0,1,0));
// Add a static mesh, add the control and node
p.setShape(someMesh);
rootNode.setControl§;
rootNode.attachChild(p.getNode());
[/java]