How do I emit particles from a geometry?

How would I emit particles from a broad sheet, such as for rain or snow? I assume I need to attach a geometry to my emitter - but I can’t find an example of the suitable code.



Could I make a complex shape an emitter - for example, have coils of mist rising from generated terrain?

You didn’t search, just admit it.



https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:particle_emitters

2 Likes

That link doesn’t answer the question about using the terrain as an emitter, does it? (I just looked at it for a couple of minutes and could not find that). :slight_smile:

To do that it seems that EmitterMeshVertexShape might be of use?

Madjack, I’ve seen that page - I misread the part about setting an EmitterSphereShape as implying the only option was a sphere. Reading it again, it makes sense now. You’re right, I should have read more carefully. But thanks for taking the time to post the link.

No probs and you’re welcome.



Advice to everyone, and that can’t be repeated enough: Do all tutorials at least ONCE. Once you’ve gone through them. Do them again. And again. Don’t just copy & paste the code lines, understand what each and every line means, what it does and how it does it. That can’t be stressed enough. Copying a tutorial, either manually or copy/paste, will not make you understand the logic. :slight_smile:



Sorry to you @ags1 I didn’t want to use your thread for that purpose but might as well. :wink:

I am doing slightly differently, I have read through all the basic tutorials (not even copy-pasted) and now I am trying to build a scene using the concepts from each tutorial - so I’m applying the tutorials to a completely new context. But I’m getting sidetracked into playing with particles…

We all have our way of learning and I’ll freely admit that I sometimes simply reuse code that I know work without 100% understanding it, but that’s not the optimal way to do things.



As long as you learn and understand what’s going on, that’s what matters.

I’ve seen people create grass and hair from particles - static particles is I think the correct term. At the risk of asking another dumb question (and I have searched madjack’s link, and googled) what property do you set to turn the effect static? My scene now has flames, smoke, snow - all it needs are some random clumps of grass.

Isn’t it just to set it to be disabled and emit all particles?

[java]emitter.setEnabled(false);

emitter.emitAllParticles();[/java]

I don’t know for certain, that’s just my guess.

Have you taken a look at the forester lib? That would be a good alternative to create grass (and other vegetation).

http://hub.jmonkeyengine.org/groups/user-code-projects/forum/topic/the-forester/



Amazing stuff!

Re static particles.



I tried



snow.emitAllParticles();

snow.setEnabled(false);



And it nearly works - it causes all particles to emit and then freezes them. But to get trails the whole path of the particle has to be rendered - so this code turns my snow into stars, not icicles.