Start/Stop particle emitter?

Hi,



is it only possible to start a particle emitter by attaching it to the root node and stop by detaching it?



greetings

2 Likes

emitter.setEnabled(false) ??

when you enter “emitter.” and then press Ctrl-Space you see all methods of that object, most of them have documentation as well, check that list next time, I guess this one is quite obvious, no?

1 Like

To answer your question about attaching and detaching… thats possible as well. And quite useful in some cases. But for an emitter that you’ll reuse, setEnabled(true/false) is your best bet.

1 Like

Sorry to bring up a slightly old post; however, I have run into a new problem that I think fits well into this thread.



I am also using the emitter.setEnabled() method; however, when its set to false, the particles that are currently in the world space freeze. I guess this is a needed feature. But I would like the particles in the world space to continue to the end of their life while stopping any new particles from entering world space.



The problem is demonstrated below.



http://www.youtube.com/watch?v=kCgsa0Iz4tE



Is there any existing solutions to this? Thanks!
1 Like

Try:

[java]setParticlesPerSecond(0);[/java]

1 Like

Thanks rickard. The setParticlesPerSecond method works. Except I’m not sure the start up of the emitter looks right. Please see the video below.



http://www.youtube.com/watch?v=yHrYW8zJyVo



Also note, I tried updating the ship model (I made it in Blender and just re-exported to obj format). JMEP gives me a warning that there are no normals; however, the image below shows normals (note, I changed the model to something simple and tried importing into JMEP and still get the same problem).


Any ideas?
1 Like

Regarding problem 1:

It seems like it’s starting out at its largest size, try lowering the startSize to something quite small.



Problem 2:

In the blender export box, you need to tick a checkbox (default unchecked), to export the normals. I know i’ve missed it quite alot of times.

1 Like

Problem 1: I actually want the start size to be larger then the end size to produce a cone like shape of the exhaust where the base of the cone is attached to the ship. If the start size is less then the end size, then its an inverse cone. Anyways, what I was thinking is that the exhaust should ramp up so that the tail isn’t displayed immediately.

(note this is a very early build of a game which was originally developed by me in Java3D - a latter build had much better graphics and even a tractor beam - unfortunately I can’t get it to compile since I had started porting it to JME2 and then dropped development due to lack of interest on my part). I figured with JME3, it would be much easier to just re-implement especially with the nice physics engine (I had written my own physics code for that build).

http://www.youtube.com/watch?v=TGNVsxFFmkc



Problem 2:
Thanks for the suggestion of ticking the normals export checkbox. I had forgotten about that. However, it still seems that something is wrong. Are the normals in the obj file represented as "vn" as shown below?
v 0.000000 0.698396 0.446545
vn 0.001228 0.999922 -0.012470
1 Like

@Momoko_Fan, shouldn’t we kill all particles when enabled is set to false?

it doesn’t really make any sense that setEnable(false) just freezes the particles…

1 Like

Version 1.22 jmep stable works with converting .obj to .j3o (I tried the same .obj file with a few days old unstable and it didn’t work). So it seems like something broke in later versions. Anyone else having this problem?

1 Like

Can you provide the obj file with the problem?

1 Like
Momoko_Fan said:
Can you provide the obj file with the problem?


Here you go. Let me know if there are any problems downloading.
OBJ File
MTL File
1 Like

Tested the model today and it seems to work fine

1 Like

Hi Guys
Is there a way to ask the emitter to make 5 particles at 2 per second for example and then stop… Without having to call .setEnabled(false); In another thread i saw some talk of .emiilParticles(n) but i cant see that in the API

thanks all

1 Like

Yes. Just call emitAllParticles(). If you want to emit at a certain time, use setNumParticles(0), so it doesn’t emit particles (only emits particles when you call the emitAllParticles()). To delete particles in the scene, just call killAllParticles().

Hope i helped you!

1 Like