← Pixel Dreamer Studio

Particles only fall down or fly sideways

A new process material has no speed and points along +X.

A ParticleProcessMaterial made with new() starts with initial_velocity_min and initial_velocity_max at 0, direction at (1, 0, 0) and gravity pulling down. So the particles only drop: in our test they fell 5 m in a straight line. Give them a speed and they shoot along +X, to the right. Set both: direction to Vector3.UP and a speed above 0.

Three emitters marked by grey dots. From the left one, sparks arc down to the right. From the middle one, a straight line of sparks falls down. From the right one, sparks rise in a small fountain
The script below in Godot 4.7 with the Compatibility renderer, lifetime 1 second, grey dots where the emitters are. Left: a new material with only a speed added. Middle: a new material as it is. Right: the script as written.

The code

Attach this to a GPUParticles3D for a small fountain. The direction and initial velocity lines are the fix.

extends GPUParticles3D
## A fountain of sparks with a ParticleProcessMaterial made in code. A new material has
## no speed and points along +X, so set the direction and the speed yourself.


func _ready() -> void:
	amount = 60
	lifetime = 1.5
	var m := ParticleProcessMaterial.new()
	m.direction = Vector3.UP  # fix 1: the default (1, 0, 0) points sideways
	m.spread = 25.0
	m.initial_velocity_min = 3.0  # fix 2: the default speed is 0, so particles only fall
	m.initial_velocity_max = 4.5
	m.gravity = Vector3(0, -6, 0)  # in 2D, use a positive y: Vector3(0, 98, 0) falls down the screen
	process_material = m
	var mat := StandardMaterial3D.new()
	mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
	mat.billboard_mode = BaseMaterial3D.BILLBOARD_PARTICLES
	mat.albedo_color = Color(1.0, 0.75, 0.3)
	var q := QuadMesh.new()
	q.size = Vector2(0.1, 0.1)
	q.material = mat
	draw_pass_1 = q

What we measured

We set the lifetime to 1 second, looked from the front with an orthographic camera and measured where the lit pixels were, in meters from the emitter, over five frames. Two runs of each.

In 2D

A GPUParticles2D with a new material had the same direction and speed. One thing changed: when we assigned the material, its gravity went from (0, -9.8, 0) to (0, 98, 0) on its own, and the particles fell 204 to 206 pixels in 2 seconds. A gravity we set ourselves, (0, -98, 0), was kept, and those particles rose 204 pixels. In 2D, y points down the screen, so a positive y falls.

What to change

Particles that fall sideways when the emitter is turned: gravity on a rotated emitter. One burst that flies out every way: explosion particles in one burst.

Tested in Godot 4.7 with the Compatibility renderer.

More how-tos: When particles do not show up