Using ParticleEmitter from a scene file

I created a particle emitter in a scene file and saved it as Particle.j3o

And then I tried to load it and start the particle emitters here (it’s in 3 loops: ix, iy, and iz):

It won’t show up. I’m looking in the right place because I loaded regular model scenes from the same directory and they showed up easily.

What am I doing wrong? Thanx!

[java]Node node = new Node(“particle”);

                Spatial spatial = Main.get().getAssetManager().loadModel("Scenes/particle.j3o");
                node = (Node) spatial;
                node.setLocalTranslation(loc.clone().add(new Vector3f(50 * ix, 50 * iy, 50 * iz)));
                emitter =(ParticleEmitter)node.getChild(0);
                //ParticleEmitter emitter = (ParticleEmitter)node.getChild("Emitter");

Is it three particle emitters, or are you trying to use it three times (in a loop)?
If you’re looping the code above to effectively get three particle emitters, you’re doing it wrong.
Outside the loop:
Load the spatial, and get the emitter.
Inside the loop:
Use emitter.clone(); and then call setLocalTranslation on the cloned emitter.
Attached the cloned emitter to the rootNode.
Call emitAllParticles (once is enough).

Btw, if you don’t loop and don’t call setLocalTranslation, does it show up? If something complex doesn’t work it’s usually a good idea to simplify to see where it goes wrong.

Edit: Ok, you have three nested loops. The suggestions above should still apply.

Thanks, Rickard.

I took your advice and even eliminated the step of translating the emitter, briefly.

Here is the complete method with the translation re-included. Still no sign of my emitters:

[java] private void createParticles(Vector3f loc) {
Spatial spatial = Main.get().getAssetManager().loadModel(“Scenes/particle.j3o”);
Node node = (Node) spatial;
emitter = (ParticleEmitter) node.getChild(0);
//ParticleEmitter emitter = (ParticleEmitter)node.getChild(“Emitter”);

    for (int ix = 0; ix < 5; ix++) {
        for (int iy = 0; iy < 5; iy++) {
            for (int iz = 0; iz < 5; iz++) {
                ParticleEmitter cur_emit = emitter.clone();
                cur_emit.setLocalTranslation(loc.clone().add(new Vector3f(50 * ix, 50 * iy, 50 * iz)));