setPosition with Particle

I think there is a problem with setPosition and ParticleEmitter.

Some particles are emitted at previous location.

I made a simple project:
https://playcanvas.com/project/578878/overview/particletest

You can click the screen to play the particles.
Expected behavior: All particles will be played at same position.

Thanks.

1 Like

Yes, I’ve noticed this as well. You begin to have to become redundant with your setPositions. I ended up just slapping that in an onUpdate and onClick event handlers because I just wanted to always make sure that it’s in the right spot, ya know?

Any updates or fixes?

The particle system runs a GPU code path, but falls back to a CPU code path in certain circumstances. It seems there is different behavior for the GPU code path compared to the CPU path.

I can force your particle systems in that project to the CPU by adding this code to the end of the initialize function in TreasureBox.js:

    this.app.graphicsDevice.forceCpuParticles =  true;

    this.particleArr.forEach(function (entity) {
        entity.particlesystem.rebuild();
    });      
    this.shine1.particlesystem.rebuild();
    this.shine2.particlesystem.rebuild();
    this.shine3.particlesystem.rebuild();

Then it seems to work fine. I’ll see if I can find where the problem is in the GPU path.