Attaching a Emitter to a Bone?


model = assetManager.loadModel("Models//MrSilly.mesh.j3o");
emit = new ParticleEmitter("Emitter", Type.Triangle, 200);
...       

AnimControl ctl = (AnimControl)model.getControl(0);
ctl.getSkeleton().getBone(0).getAttachmentsNode().attachChild(emit);



If I use rootNode.attachChild(emit); I see the emitter

If I attach to the bone I dont see the Emitter

any ideas?

I don't remember exactly… I think that the first time you use an attachment node for a bone, you must attach it to the model or rootNode first, as by default it is not attached.

you have to attach the emitter to the bone AND the bone (or the whole model) to the rootNode

[java]ctl.getSkeleton().getBone(0).getAttachmentsNode().attachChild(emit);

rootNode.attachChild(model);

[/java]

Actually you don’t have to do that anymore.

With the latest version of jME, you can just go AnimControl.getAttachmentsNode() and it will handle everything for you