Skip to content

[Reviewed] [3D particle emitter] Fix the emission zone radius and relative particles with the 3D renderer world scale - #2290

Merged
4ian merged 1 commit into
mainfrom
claude/dreamy-galileo-ie3la4
Oct 3, 2026
Merged

4ian merged 1 commit into
mainfrom
claude/dreamy-galileo-ie3la4

Conversation

@4ian

@4ian 4ian commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Follow-up of #2277 (emission zone radius) and #2193, for the Three.js upgrade: 4ian/GDevelop#8853

The emitter is in the layer, whose Three.js scene is scaled by 1 / worldScale. So the emitter's world matrix already converts the emitter shape, and the velocities of relative particles, from pixels to Three.js world units. Converting them in the extension too divided them by the world scale twice.

Changes (3.2.0 → 3.2.1)

  • Emission zone radius: no longer multiplied by inverseWorldScale. Zones were 100× too small with the upgrade.
  • Start speed and gravity: converted only for particles in world space. three.quarks cancels the emitter scale on world-space velocities, so Handle the 3D renderer world scale in some extensions #2193's conversion is right there. For relative particles ("Are particles relative"), velocities are in emitter units, and they were 100× too slow. The values are kept and re-applied when the relative setting changes.
  • Trail start length: no longer converted. It's a number of recorded positions ("one per frame"), not a distance: 120 became 1.2, which made trails almost invisible.
  • Emitter creation: updateWorldMatrix(true, true) instead of updateMatrixWorld(true), so the parents (with the layer scale) are up to date and the very first particles get the right scale too.

Nothing changes on GDevelop versions without the world scale (inverseWorldScale is 1 there).

Testing

verifyExtension('ParticleEmitter3D') returns success.

I created an emitter in the 3D tank example (zone radius 500, spray angle 0, speed 100), rendered every frame, and measured the spawned particles in pixels on a GDevelop build with the runtime of #8853 and on the current release:

Mode Mean distance to the emitter Speed
Before, with #8853 world space 3.5 px (median) 100 px/s
Before, with #8853 relative 3.5 px 1 px/s
After, with #8853 world space 341 px 100 px/s
After, with #8853 relative 343 px 100 px/s
After, current release world space / relative 415 / 316 px 100 px/s

(The expected mean distance in a disc of radius 500 is ~333 px; differences come from the random spawn positions.)

🤖 Generated with Claude Code

https://claude.ai/code/session_01HdyuCYDD8w7U2Q3p1aHY5M


Generated by Claude Code

…ative particles with the 3D renderer world scale

The emitter transformation (which includes the scale of the layer, i.e.
the 3D renderer world scale) already converts the emitter shape, and the
velocities of relative particles, to the Three.js world units:
- The emission zone radius was converted twice: zones were 100 times too
  small.
- The start speed and the gravity are now converted only for particles in
  world space: relative particles were 100 times too slow.
- The trail length is a number of positions, not a distance: it is no
  longer converted (trails were almost invisible).
- The emitter world matrix is updated with its parents when created, so
  that the first particles are emitted with the layer scale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HdyuCYDD8w7U2Q3p1aHY5M
@4ian
4ian requested a review from a team as a code owner October 3, 2026 17:50
@4ian
4ian merged commit 5b615c2 into main Oct 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants