We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! ParticleEmitter ignores z-index. I use it with ParticleTransform.Local. code here
import { Engine, EmitterType, ParticleEmitter, vec, Actor, Rectangle, Color, ParticleTransform, } from 'excalibur'; class Game extends Engine { constructor(props) { super(props); } onInitialize() { this.currentScene.camera.pos.setTo(0, 0); this.addActor(); this.addEmitter(); } addActor() { const actor = new Actor({ width: 200, height: 200, z: 1, }); actor.graphics.use( new Rectangle({ width: actor.width, height: actor.height, color: Color.Blue, }) ); this.currentScene.add(actor); } addEmitter() { const emitter = new ParticleEmitter({ width: 400, height: 400, x: 0, y: -50, emitterType: EmitterType.Circle, radius: 250, acceleration: vec(0, -100), minVel: 0, maxVel: 0, minAngle: 0.6, maxAngle: 2.8, opacity: 1, emitRate: 100, fadeFlag: false, isEmitting: true, particleLife: 1500, maxSize: 1, minSize: 1, startSize: 40, endSize: 0, particleTransform: ParticleTransform.Local, }); emitter.z = 2; this.currentScene.add(emitter); } } const engine = new Game({ width: 600, height: 400, }); engine.start(); `
The text was updated successfully, but these errors were encountered:
@ikiselev1989 Definitely a bug! I have a commit on main that hasn't shipped yet (I'll be cutting a v0.29.2 very soon, otherwise the alpha has the fix)
Here is a potential workaround for now, it involves monkeypatching the particle emitter. You need to pick a z unfortunately so less ideal
const original = (ParticleEmitter.prototype as any)._createParticle; (ParticleEmitter.prototype as any)._createParticle = function () { const particle = original.call(this); const tx = particle.get(TransformComponent); tx.z = 100; return particle; }
Sorry, something went wrong.
Fixed in the latest release!
No branches or pull requests
Hi! ParticleEmitter ignores z-index.
I use it with ParticleTransform.Local.
code here
The text was updated successfully, but these errors were encountered: