Setting size of area in ParticleEmitter

hi, i’ve been playing around with particle emitters and one thing i cant seem to figure it out is how to have a large area of the same particles, for example consider the below class:

[java]public class HeartParticleEffect extends ParticleEmitter{

private Material mat;

public HeartParticleEffect(String name, AssetManager assetManager){

super(name, ParticleMesh.Type.Triangle, 5);

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

mat.setTexture(“Texture”, assetManager.loadTexture(“Particles/heart.png”));

load();

}

private void load(){

this.setMaterial(mat);

this.setImagesX(2);

this.setImagesY(2); // 2x2 texture animation

// this.setEndColor(new ColorRGBA(0.80f, 0.36f, 0.36f, 1f));

this.setEndColor(new ColorRGBA(1f, 0.41f, 0.7f, 0.5f));

this.setStartColor(new ColorRGBA(1f, 0f, 0f, 1f));

this.setInitialVelocity(new Vector3f(0, 2, 0));

this.setParticlesPerSec(5f);

this.setStartSize(0.2f);

this.setEndSize(0.1f);

this.setGravity(0);

this.setLowLife(0.5f);

this.setHighLife(3f);

this.setVelocityVariation(0.1f); // controls dispersion

}

}[/java]

i attach this to a node created at the players location whenever i click on the GUI, that works fine, however this creates a small fire at my feet, what would i need to change to make fire say all around my feet, just create more with spacing in specified area ?

i tried using the spatial elements of the particleemitter and the node i was attaching to (i.e. setLocalScale) however that had no effect.



edit: without altering size of the seperate particles, increasing num of particles only increases density within that small area

Thanks in advance

any ideas ?

i think you can set the shape of the Emitter.



ParticleEmitter has a public method setShape(EmitterShape shape)

i believe the emitter will spawn particles randomly(starting points) within the confines of the emitter shape bounds.



different shapes you can use can be found under com/jme3/effect/shapes/

i.e.

EmitterBoxShape,

EmitterMeshConvexHullShape,

EmitterMeshFaceShape,

EmitterMeshVertexShape,

EmitterPointShape,

EmitterShape,

EmitterSphereShape

1 Like

aha ! thank you