Particle System cc.ParticleSystem.TYPE_FREE, issue related to rotation

I am creating a particle system that is attached to a parent node. The parent node moves and rotates over the life of the game.

currently my particle position type is set to FREE, and when translating the parent node, the particles behave as expected. The particle that already exist in the scene move freely from the emitter, and new particles that spawn start from the new emitter location. This all falls apart when I start rotating the parent.

I have found other topics on the forum relating to this bug (https://github.com/cocos2d/cocos2d-x/issues/8384), but it doesn’t look like there is a fix implemented yet.

I know the issue needs to be addressed in the update loop of CCParticleSystem.js, and I have a basic understanding that I need to convert the particle into world space and inverse the rotation, but this is where I get a bit lost. My matrix math is not what I would like it to be :slight_smile:

Any help or advise on the matter would be very helpful, please let me know if I can provide any more relevant information

Okay I found a suitable work around

Rotate the emitter node opposite to the parent node’s rotation and then set the system angle to the parents rotations. This is allow the emitter to rotate with the parent for emission, but the system will not all rotate as one

    this.emitterNode.rotation = (-1 * this.parentNode.rotation);
    this.emitterNode._particles.angle = (this.parentNode.rotation + 90);

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.