← Pixel Dreamer Studio

Particles fall sideways when you rotate the emitter

Aim with the node's rotation. Keep gravity in the world.

The direction of a ParticleProcessMaterial is in the node's own space, so rotating a GPUParticles3D aims the spray. With local_coords on, the gravity turns with the node too: aimed sideways, our sparks were pulled sideways and never fell. Turn local_coords off, the default: the spray still goes where the node points, and gravity pulls down in the world.

Two sideways nozzles spraying small orange sparks to the left. The top spray curls back to the right past its nozzle. The bottom spray goes left and falls down
The script below in Godot 4.7 with the Compatibility renderer, both emitters turned to point left. Top: Local Coords on. Bottom: the script as written, Local Coords off.

The code

Attach this to a GPUParticles3D and rotate the node to aim the sparks, for a grinder, a broken pipe or a gun. The local_coords line is the fix.

extends GPUParticles3D
## Sparks sprayed the way the node points, then falling to the ground.
## Rotate the node to aim. Gravity stays world-down because local_coords is off.


func _ready() -> void:
	amount = 30
	lifetime = 1.0
	local_coords = false  # the fix: gravity pulls down in the world, whichever way the node points
	var m := ParticleProcessMaterial.new()
	m.direction = Vector3.UP  # the node's own up: rotate the node to aim the spray
	m.spread = 15.0
	m.initial_velocity_min = 2.5
	m.initial_velocity_max = 3.5
	m.gravity = Vector3(0, -9.8, 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(1.0, 0.7, 0.3)
	var q := QuadMesh.new()
	q.size = Vector2(0.06, 0.06)
	q.material = mat
	draw_pass_1 = q

What we measured

We turned the emitter 90 degrees so its up pointed left, and let out one particle at 2 meters per second with gravity at 9.8. With a camera looking straight at it, we measured where the particle was, in meters from the emitter, 0.3 and 0.6 seconds after it was born. Two runs gave the same numbers.

When local_coords should stay on

An aura or a shield that has to walk and turn with a character needs local_coords on. If it also needs gravity, keep gravity at zero and let the particles rise or drift instead, or put the falling part in a second emitter with local_coords off.

What to change

Particles that turn with a character on purpose: magic aura particles. Sparks from an object that is moving: inherit velocity from a moving emitter. A flash at the end of a barrel: muzzle flash with a light.

Tested in Godot 4.7 with the Compatibility renderer.

More how-tos: Projectiles and aiming