Particle emitter question

Godot Version

Godot 4.x

Question

Hey all, I ran into a bit of a weird hiccup yesterday with a weapon and Cpuparticle node.

I have it set so particles emit when a weapon fires but if the rate of fire is faster than the particle life, there are shots where nothing emits.

Is there a setting on the emitter which will allow it to start a new emit cycle while already emitting? I was thinking I could instantiate the emitter in my shoot function so I’m sure that would work but thought there might be an easier approach

Particle emitters have a .restart() function you can use instead of setting emitting to true if needed, but it may look odd depending on the use case.

Okay I’ll try that out. If it deletes active particles it probably won’t look how I’m hoping.

It’s for smoke/muzzle flare on a rifle. Would it be more performant using restart() over say a pool of particle emitters or instantiating new emitters every shot?

Just put two of them on the exact same position and let each take care of every other particle emission. Could track with some int

var anything: int = 1

func emit_stuff():

If anything == 1: let first one emit; anything += 1

If anything == 2: let second one emit; anything = 1

Could you get away with giving the particle emitter a higher amount? If your particles lifetime / amount roughly matches your weapons fire rate it should look it’s firing so long as you enable and disable emitting while it is firing.

Thanks again for the replies.

I use a timer to reset a can attack bool (CD) and found when the timer is set to 0.2-0.6 range it’s most noticeable. I’d like to have flexibility to have very rapid emission and animations for attack speeds.

I’m thinking that combing the restart command with a second particle emitter would probably work really well.

Thinking that switching between the two with a condition of “if emitting restart” to help any overlap

Thank you two so much, combining the 2 ideas worked really well. I’ve tested attack speeds as quick as 0.01 and this works great.

	if wep_particles != null:
		if wep_particles.emitting == true:
			wep_particles_2.emitting = true
			wep_particles.restart()
		else:
			wep_particles.emitting = true
			wep_particles_2.restart()`