Basically subj. It's almost a duplicate of this question https://godotengine.org/qa/32039/create-particles2d-that-radiates-particles-every-direction
But the accepted solution emits particles in random directions.

Godot version 3.3.2
in Engine

I also wanted to do this so I tried converting the particle material to a particle shader and editing the shader. I haven't done anything with shaders before so this might not be proper but it is what I have so far.

In order to spread the particles out evenly the shader would have to know the amount of particles. This doesn't seem to be available in the vertex buffer (?) so I resorted to passing the shader a uniform value

``````uniform float initial_particle_amount; // added this
``````

but I have to set that value manually or with a script.
Then I replaced the line

``````float angle1_rad = rand_from_seed_m1_p1(alt_seed) * spread_rad;
``````

with

``````float angle1_rad = (float(INDEX) * (spread_rad / (initial_particle_amount / 2.0)));
``````

and that emitted the particles in and even spread.

I noticed there is a initialanglerandom value but I don't understand what it does. Ideally we would be able to set a value between 0 and 1 to control the "randomness" of the particle spread.

+1 vote

You can convert particle material to particle shader, and there override direction/velocity code. You will have to write similar function to what You would do in Godot - iterate through angles of circle and assign direction within chosen intervals. You will have to learn shader language tho. Try to come up with something and post Your result here, I will try to correct You.

by (5,649 points)
selected

Thanks! I already tried it with shaders but couldn't find a way to get the particle's number then (since explosiveness may be 100%). Just needed to RTFM. :/ There are two. NUMBER and INDEX. So, replace

``````float angle1_rad = rand_from_seed_m1_p1(alt_seed) * spread_rad;
``````

with

``````float angle1_rad = fract(float(NUMBER) * angle_step) * spread_rad;
``````

Where `angle_step` is a uniform float. And this would be the first time I successfully tinkered with shaders.