[SOLVED] Change Color of particleSystem


I’ve randomly color entitys in our game and want to set the first color of the particlesystem to that, so if they explode the colors matches…

I found this one:

this.entityParticleEngine.particlesystem.colorGraph.curves[0].keys[0][1] = 0.2;

My question is: where do I add the color? 0.2 :roll_eyes:

Expectet something like pc.Color or RGB ?


Hi @Gurki,

Yeah, that’s an internal API, not sure if changing the particles color on runtime is exposed on a public API.

In any case, if that works for you to change all RGB values do this:

this.entityParticleEngine.particlesystem.colorGraph.curves[0].keys[0][1] = red;
this.entityParticleEngine.particlesystem.colorGraph.curves[1].keys[0][1] = green;
this.entityParticleEngine.particlesystem.colorGraph.curves[2].keys[0][1] = blue;

And at the end I think you still need to rebuild the graph, do check this if it’s required.

1 Like

I gave it a try on the fireball particles example, indeed it works after using rebuild().



just works fine :laughing:

PsColor.prototype.setColor = function (Color){

this.entity.particlesystem.colorGraph.curves[0].keys[0][1] = Color.r;
this.entity.particlesystem.colorGraph.curves[1].keys[0][1] = Color.g;
this.entity.particlesystem.colorGraph.curves[2].keys[0][1] = Color.b;



1 Like