I have a problem with the particle emitter

https://youtu.be/179I5bDDB1g

I use the whole model as a transmitter.
But I didn’t see any particle effects and I thought it was something I set up but when I looked closely I saw that the particles were there.
He’s very small in the middle of the model but you can see the particles surrounding the model and making A-POSE.
I wonder why this is.
Ideally, the particles should be all around the model, not in the middle

/**
 *
 * @author icyboxs
 */
public class ParticleEmitterEffects extends BaseAppState{
       private AssetManager assetManager;
       private SimpleApplication simpleApp;
       private ParticleEmitter fire;
       private Emitter emitter;
       private Geometry collisionShape;
    @Override
    protected void initialize(Application app) {
        assetManager=app.getAssetManager();
        simpleApp=(SimpleApplication) app;


 Node model = ((Node)((Node)((Node)simpleApp.getRootNode().getChild("character")).getChild("Scene")).getChild("Bip001"));
    Geometry geometry=(Geometry)model.getChild("网格.004");

   Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");//Common/MatDefs/Light/Lighting.j3md   Common/MatDefs/Misc/Particle.j3md
  // Material mat1= new Material(assetManager, "Models/AYA/AYA.j3md"); 
    mat.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
    Texture tex = assetManager.loadTexture("Effects/Particles/part_light.png");//Models/Syana/Sn.j3o   Effects/Particles/part_light.png
    mat.setTexture("Texture", tex);

    emitter = new Emitter("test", mat, 100,
        new ColorInfluencer(),
        new SizeInfluencer());
    emitter.setStartSpeed(new ValueType(6.5f));
    emitter.setLifeFixedDuration(2.0f);
//    emitter.setEmissionsPerSecond(20);
//    emitter.setParticlesPerEmission(1);
    emitter.setShape(new EmitterMesh());
    
    ((EmitterMesh)emitter.getShape()).setShape(geometry.getMesh());
    emitter.getInfluencer(ColorInfluencer.class).setColorOverTime(new ColorValueType(
        new Gradient().addGradPoint(new ColorRGBA(0.8f, 0.6f, 0.0f, 0.6f), 0.0f)
            .addGradPoint(new ColorRGBA(0.8f, 0.0f, 0.0f, 0.5f), 0.8f)
            .addGradPoint(new ColorRGBA(0.2f, 0.2f, 0.2f, 0.0f), 1.0f)
    ));


    emitter.getInfluencer(SizeInfluencer.class).setSizeOverTime(new ValueType(new Curve()
        .addControlPoint(null, new Vector2f(0.0f, 1.0f), new Vector2f(0.3f, 1.0f))
        .addControlPoint(new Vector2f(0.7f, 0.5f), new Vector2f(1.0f, 0.5f), null)
    ));
    emitter.setStartSize(new ValueType(0.1f));
    emitter.setStartSpeed(new ValueType(0.1f));
    emitter.setLifeMinMax(new ValueType(1.0f), new ValueType(1.0f));
    emitter.setEmissionsPerSecond(20);
    emitter.setParticlesPerEmission(4);
         Mesh box = new Box(1, 1, 1);
        Geometry geom = new Geometry("Box");
        geom.setMesh(box);
        geom.setMaterial(mat);
    
    //emitter.setParticleMeshType(ParticleDataTemplateMesh.class,geom.getMesh());
    //emitter.setLocalTranslation(0, 0.5f, 0);
    emitter.setDebug(assetManager, true, true);
    model.attachChild(emitter);
    // model.scale(2f);
    //emitter.setParticlesFollowEmitter(false);

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

    }

    @Override
    protected void cleanup(Application app) {
        
    }

    @Override
    protected void onEnable() {

    }

    @Override
    protected void onDisable() {
        
    }
    
        @Override
    public void update(float tpf) {

    // emitter.setLocalTranslation(simpleApp.getRootNode().getChild("character").getWorldTranslation());
    // System.err.println(simpleApp.getRootNode().getChild("character").getLocalTranslation());
//     System.err.println(simpleApp.getRootNode().getChild("character").getWorldTranslation()+"(world)");
    }
    
}

I use this code to set the particle effect
model file(I think it’s not my model problem).
(The above content will be translated using the translator, if you have any questions please point out thank you very much)

1 Like

Hardware skinning means the mesh data in main memory aren’t updated. Try disabling hardware skinning in the model’s SkinningControl or SkeletonControl:

sControl.setHardwareSkinningPreferred(false);
1 Like

First of all, thank you for your reply.

    modelSkinningControl = ((Node)modelSyana.model).getChild(0).getControl(SkinningControl.class);

        modelSkinningControl.setHardwareSkinningPreferred(false);


Close the hardware skin,
The model gets weird,

Particles still surround the model,
I might need some more hints.

Finally, thank you for your help :smiling_face_with_three_hearts:

1 Like

Pretty sure I know what is going on here. Particle monkey only takes into account the raw mesh at the moment so it doesn’t know about any transforms applied to that mesh (IE scale / translation / rotation). Should be a pretty easy fix. Just to be sure, you could try removing any sort of transforms from the geometry and seeing if it renders as expected.

2 Likes

First,Thank you for your reply :smiling_face_with_three_hearts:

If I use a model with no model animation as a particle emitter then everything is fine

I wanted to make a similar effect using particle monkeys.

Thank you for pointing out the key issues.
Will I see this feature in a future release?
Finally, thank you for your reply and help :smiling_face_with_three_hearts:
(The above content is translated using a translator if you have any questions please point out)

I just pushed a change to how the EmitterMesh works. It now takes a geometry object and will apply the world transform of the geometry to the triangle it selects to emit from. I’ll have to figure out some sort of test case to add to my examples project before I can test it myself.

2 Likes

:laughing: :laughing:Thank you for your help

video
I took the latest particle monkey code from github and compiled it,
During use it was found that the particles did not seem to emerge from the emitter position, but appeared in unexpected locations as the model moved.

I guess it’s the world transform resulting problems
Is there any way to set it to local transform?

Is the emitter being attached and transformed along with the model you are emitting from?


And when I rotate the model

(That’s the emitter and I’m going to use the whole model as the emitter)

the particles go in different directions

It doesn’t appear to be attached and transformed at this point


The problem seems to persist.
Particles surround the original grid.

I seem to have misunderstood this sentence.

I’d like to say yes I need the transmitter and the launch model attached and transformed

Discussion continues here: