I have some confusion and some questions

video
I tried a lot,
I don’t have a deep understanding of how particles work…Just some basic knowledge.

I made some code changes,

//model.attachChild(emitter);  
simpleApp.getRootNode().attachChild(emitter);

I also turned off the hardware skin

modelSkinningControl.setHardwareSkinningPreferred(false);

The complete code is here
I want to know why the particle and the particle emitter aren’t together.
You can see that in the video,emitter Stay where you are particle follow the character model
Although the final result is good to complete my idea :grinning:.
But I didn’t understand,

One more question This setting does not work

emitter.setParticlesFollowEmitter(false);
1 Like

If emitter.setInWorldSpace(false) solves the problem, then you are seeing the effects of a known bug in JMonkeyEngine.

2 Likes

Thank you for your reply :smiling_face_with_three_hearts:

I have also noticed this issue with Particle Monkey’s Emitter. I meant to make a post about it a while ago and forgot. In my case I have experienced the issue while using a regular Cone and Sphere EmitterShape.

I have never experienced the issue using jme’s stock ParticleEmitter with setInWorldSpace(true), but based on the issue report sgold linked, it sounds like that is because I never set an EmitterShape with with the stock ParticleEmitter and always just let it emit from a single point.

1 Like

I made some version try I find version 1.0.2 and 1.0.3 setParticlesFollowEmitter is effective.
1.1.0 version setParticlesFollowEmitter Have no effect
I’m still comparing the content.

My guess is it’s the original grid problem

1 Like

One good news and one bad news…
particlemonkey/EmitterMesh.java at f2471db7f7613db9f6e00955525502ae000d7105 · Jeddic/particlemonkey (github.com)
After a while of searching I found this code

mesh.getWorldTransform() I change it to mesh.getLocalTransform() I wonder if making this modification will affect anything?

emitter.setParticlesFollowEmitter(false); This setting is now in effect

But I have another problem now and I need a little time to organize the description of the problem…(Bad news :upside_down_face:)

So, I finally have a few good test cases setup in my examples project. The mesh.getWorldTransform() is intended. It doesn’t work for you because you are transforming the emitter along with the model. This is a pretty common use case though so I’m looking at it as I go over the code for setParticlesFollowEmitter which looks like it is pretty broken. I think I’ve got translation ironed out at the moment, but I have some sort of rotation bug I need figure out before I push the fixes. Thanks for the help tracking this down. If you have any other issues let me know and I’ll check into them.

3 Likes

InWorldSpace=false is the Local Transform of the particle.
Particle monkey How do I Local Transform the particle?
Or how does the particle monkey Transform the two particles in the video.
Local Transform and World Transform.

emitter.setParticlesFollowEmitter(false);It doesn’t seem to work for me,
Just like you said

How do I change the WorldTransform and LocalTransform of a particle in the current situation?

1 Like

I just pushed some changes yesterday that should work for you. Basically, if you added the emitter to the root node so it wasn’t moved then it would have worked, however, since you moved the emitter then it would basically apply the emitter transform as well as the mesh transform. This effectively doubled the transform. I reworked the code so emitter.setParticlesFollowEmitter(false); should work for you now if the emitter is moved. Give it a shot and let me know.

1 Like

First of all, thank you for your reply And help :smiling_face_with_three_hearts:

    emitter.setParticlesFollowEmitter(false);
    simpleApp.getRootNode().attachChild(emitter);

I add the emitter to the root node And set emitter.setParticlesFollowEmitter(false);
But it still didn’t work
As you can see from the video, the particles still don’t follow the model

Supplementary Content:
I found out that I didn’t get all of the files, so I re-ran “Git” and compiled it after getting all the code


The difference is that the emitter grid is smaller, but emitter.setParticlesFollowEmitter (false); is still invalid. :face_with_raised_eyebrow:

I want to know what I missed or what I did wrong.

It looks like it is doing exactly what it is supposed to. SetParticlesFollowEmitter when set to false means that once they are emitted they are in world space so moving the emitter won’t change the translation. I thought that was what you were trying to do.

I made a change to the EmitterMesh class that will switch if the emitter mesh gives you local or global positions for the particles that get emitted.

new EmitterMesh(model, false);

or

emitterMesh.setEmitFromWorldSpace(false);
1 Like

Side note, the debug mesh won’t be in the correct position. The code doesn’t currently sync the emitterShape location and only takes the location it was first turned on at.

1 Like

This is the only problem I’m trying to do at the moment is that I can’t switch the particle InworldSpace to adjust whether the particle transition is in world or Local, like in the video.

I want to know how I can achieve the effect in the video in Particle Monkey.
So far the effect of “InworldSpace=true” in the video has been completed, how to complete the effect of “InworldSpace=false”?

Thank you for your recent help. Thank you very much @glh3586 :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

It took a while, I looked at the code changes,
I have a new solution to the problem posed earlier, but I have run into a problem.

((Node)((Node)((Node)simpleApp.getRootNode().getChild("character")))).attachChild(emitter);

I now add the emitter to the node of the model instead of the root node.
And use setEmitFromWorldSpace and setParticlesFollowEmitter to control the particle transform.

emitterMesh.setEmitFromWorldSpace(true);
emitter.setParticlesFollowEmitter(false);

When I make these set in the code, the particle effect works perfectly as expected.


The debug mesh is misaligned but it doesn’t matter, the particles appear in the right place and have the right effect.

emitterMesh.setEmitFromWorldSpace(false);
emitter.setParticlesFollowEmitter(true);

When I do these set in the code, it appears as in the video that the particle-wrapped mesh seems much larger.
As you can see from the video,The particle wrapped grid seems to be much larger than the emitter.

supplement:

The problem occurs when transform=flase.
It seems to be problem with mesh.getLocalTransform();.
But I’m still not sure why mesh.getLocalTransform(); particle wrapped mesh is much larger than the emitter.
I still can’t find further problems in the code and my current knowledge is not enough to allow me to understand the data design in the particle.

Supplement 2:
I was trying to make sense of it without a clue.
Until I suddenly had an idea .

emitter.setLocalTransform(model.getWorldTransform());

I tried to change the emitter Transform
I found that everything worked (but not completely)
The emitter got smaller, the particles got smaller, but the particles wrapped around the model and did what I wanted them to do.
I still don’t understand how Particle Monkey controls the emitter mesh and the particle mesh , I can’t provide a valid code , I’m very sorry …

What is certain is emitterMesh. SetEmitFromWorldSpace (false); The emitter is not in sync with the model’s transform