← Pixel Dreamer Studio

Freeze particles in mid-air

speed_scale 0 stops them where they are. Turning emitting off or hiding them does not.

Set the emitter's speed_scale to 0: every particle stops where it is, and setting it back to 1 lets them go on from there. In our test nothing on screen changed in a whole second while frozen. Setting emitting to false is not a freeze: it only stops new particles, and the ones already out kept flying until their lifetime ran out.

The same scene twice, side by side, with a blue and an orange spark fountain. The blue sparks are in the same places in both, the orange ones have spread out
The script below in Godot 4.7 with the Compatibility renderer, two fountains. The blue one was frozen with freeze(true) at 0.9 seconds, the orange one kept running. Left half: 1 second in. Right half: 1 second later. The blue sparks have not moved.

The code

Attach this to a GPUParticles3D and call freeze(true) and freeze(false). The speed_scale line is the fix.

extends GPUParticles3D
## A fountain of sparks that can be frozen in mid-air, for a time stop or a photo mode.
## freeze(true) stops every spark where it is. freeze(false) lets them go on from there.


func _ready() -> void:
	amount = 80
	lifetime = 2.0
	var m := ParticleProcessMaterial.new()
	m.direction = Vector3.UP
	m.spread = 40.0
	m.initial_velocity_min = 2.0
	m.initial_velocity_max = 4.0
	m.gravity = Vector3(0, -4, 0)
	process_material = m
	var mat := StandardMaterial3D.new()
	mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
	mat.billboard_mode = BaseMaterial3D.BILLBOARD_PARTICLES
	mat.albedo_color = Color(0.5, 0.9, 1.0)
	var q := QuadMesh.new()
	q.size = Vector2(0.08, 0.08)
	q.material = mat
	draw_pass_1 = q


func freeze(on: bool) -> void:
	speed_scale = 0.0 if on else 1.0  # the fix: 0 stops every spark where it is

What we measured

We ran the fountain for 1 second, changed one thing, and compared the screen before and 1 second later, every second pixel. Two runs of each.

Freeze only some effects

Pausing the tree froze the sparks too, but it also stops everything else that can pause. To freeze only some effects, for a time stop where the player keeps moving, set speed_scale on those emitters. For the opposite, an effect that keeps playing on a pause screen: level up effect while paused.

What to change

Slowing the whole game for a hit: hit stop with time scale. Stopping a looping effect and letting it fade: fade out looping particles.

Tested in Godot 4.7 with the Compatibility renderer.

More how-tos: Play, stop and remove effects