Non-typical particle emitting

So I have a few unusual questions about particle emitters. The first one would be how to emit particles that arent billboards and always face the player, so I could make something like this:
http://static.ddmcdn.com/gif/blogs/6a00d8341bf67c53ef0133f54560c1970b-800wi.jpg
What I have done so far is get the emitter to at least get to the right positions for the particles like this every frame (while the emitter is set to InWorldSpace):

 emitter.setLocalTranslation(FastMath.rand.nextFloat()*1000-500,
                             FastMath.rand.nextFloat()*1000-500,
                             FastMath.rand.nextFloat()*2000);

Which seems to me like an unnecessary and dumb way to do it, but it seems that there is no way to set a single particle’s location at all, is there?
Now the other problem is that the particles are all square and I cant seem to find a way to get them elongated. I could of course spawn Box geometries with large depth values and write my own custom emitter but then what’s the point of the official one.

The next question is how to stop an emitter from emitting without disabling the system itself. (unrelated to the first question I need it for engine exausts).
setEnabled(false) is out of the question since it freezes the particles and I’d like the remaining ones to continue travelling.
This also disqualifies detaching the emitter since they arent supposed to suddently vanish either.
The remaining obvious option is setParticlesPerSec(0f) which doesn’t do anything at all if used with common sense. What kinda works for me is this:

Setting up the emitter so the beginning PerSec value is zero:

*emitter.setParticlesPerSec(0f);*

And then doing this every frame:

*if(!SupposedToBeEmitting)*
    *emitter.setParticlesPerSec(80f);*

Not sure how I arrived at this weird setup but it seems to work. The problem is that its very framerate unreliable. One spike and the emitter decides to throw out particles until the fps stabilises again. This is kind of the exact opposite is what should the code be if the emitters behaved correctly but I cant seem to get it working.

EDIT: Disregard everything in italic, it seems that I had some forgotten code that was messing stuff up. Starting the particle emitter with setParticlesPerSec(0f) and then to the emitting value and back seems to be working correctly now.
The first question still remains.

TestExplosionEffect does exactly what you want: jmonkeyengine/TestExplosionEffect.java at master · jMonkeyEngine/jmonkeyengine · GitHub

If you go to the createSpark() method, you will see a call to

setFacingVelocity(true);

which makes the sparks face their velocity thus creating the effect you showed in the image.

Awesome, I seem to have overlooked that. :smiley:

@Momoko_Fan one more thing. Looking foreward makes the effect perfect, but as soon as the camera renders it at a different angle …


Is there any way to prevent that? I’m using an image that looks like this: | for the texture.

I am not sure exactly what effect you’re trying to achieve here… You may need to ensure the particle emitter is always in front of the camera and the particle velocity is always the opposite of the camera direction.

Oh well that would defeat the purpose. I guess I haven’t really explained what this is for, it’s a warp jump effect. Here’s how I had it done in another engine:


The effect should always travel inline with the ship and the camera needs to be able to look around inside it. I think the logical way would be to make the normals of the particle triangles to face a line that goes through the middle of the ship and along the effect, but that doesn’t fix the smearing.

How did you do it in the other engine?

That’s how. But the jme3 emitters only seem to support ParticleMesh.Type.Triangle and ParticleMesh.Type.Point. Notice how none of those two is a Box.

I have this problem too with the normal Particle emitter, mind to share your custom particle if you decide to do it ?

@wagfeliz Yeah sure thing, but I’ll give this thread a few days to see if anyone else knows anything.

Yeah, I know… I was just curious how it worked in the other engine. No need to be short.

JME’s particle emitter is super-limited and really only useful for particles. It’s very likely that for moving stars and stuff you will be happier rolling something custom. It might be more familiar to what you’d done before.

For me, I’d probably use some shader tricks plus a batch of quads… but if you are new to shaders that’s probably the hard way to go.

“Hyperspace capability… impressive!” ©
Seriously, the need for this kind of thing will soon meet me as well.