Skip to content

fix: respect particle config z when ParticleTransform.Global is set (#3748)#3749

Open
MohammadYusif wants to merge 1 commit into
excaliburjs:mainfrom
MohammadYusif:fix/issue-3748
Open

fix: respect particle config z when ParticleTransform.Global is set (#3748)#3749
MohammadYusif wants to merge 1 commit into
excaliburjs:mainfrom
MohammadYusif:fix/issue-3748

Conversation

@MohammadYusif

Copy link
Copy Markdown

===:clipboard: PR Checklist :clipboard:===

  • ๐Ÿ“Œ issue exists in github for these changes
  • ๐Ÿ”ฌ existing tests still pass
  • ๐Ÿ™ˆ code conforms to the style guide
  • ๐Ÿ“ new tests written and passing / old tests updated with new scenario(s)
  • ๐Ÿ“„ changelog entry added (or not needed)

==================

Closes #3748

Changes:

  • In src/engine/particles/particle-emitter.ts, changed the z assignment in _createParticle from this.z to (this.particle.z ?? this.z) so that a z value specified in the particle config takes precedence over the emitter-level z, while retaining backward compatibility for emitters that only set z on themselves
  • Added two regression tests to src/spec/vitest/particle-spec.ts โ€” one verifying that particle.z overrides the emitter's z when ParticleTransform.Global is active, and one verifying the emitter's z is still used as a fallback when no particle.z is set

โ€ฆxcaliburjs#3748)

When creating particles with ParticleTransform.Global, the z value from
the particle config (this.particle.z) was not being respected. The
_createParticle method only passed the emitter-level z (this.z) to each
particle, causing any z set in the particle config to be silently ignored.

The fix prefers this.particle.z when present and falls back to the
emitter's this.z, preserving backward-compatible behavior for users who
only set z on the emitter.
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.

Particles z index not working

1 participant