pixijs / particle-emitter

A particle system for PixiJS
http://pixijs.io/particle-emitter/docs
MIT License
793 stars 125 forks source link

Sub-emitters? #92

Closed digilocker closed 3 years ago

digilocker commented 5 years ago

I was wondering if there was an easier way of possibly adding sub emitters? I had an idea for a fireball effect with the fireballs being the main particles then a smoke trail following their position.

Had a trial yesterday and managed to get something working but required quite a few workarounds using timers to check the last particle added etc..

Any easier ways something similar could be achieved that I am missing, or is it a feature that could possibly be added?

http://www.html5gamedevs.com/topic/42106-pixi-particles-and-subemitters/

andrewstart commented 5 years ago

I had considered making a subclass of Particle that owns an Emitter and updates it automatically, which should do the trick. Unfortunately, I currently don't have the time to do so, but that is the road that I would try to go down.

digilocker commented 5 years ago

Awesome, thanks for the update, just wanted to make sure I wasn't missing a trick :)

andrewstart commented 3 years ago

This is now easy to make with the behaviors in release 5.0.0.

tankorsmash commented 9 months ago

@andrewstart I'm looking through the behaviors. Would the recommended way of creating subemitters be through a second PointSpawn? I looked through a few examples in the README and I didn't see any that appear to use subemitters.

Say I wanted to add smoke to https://pixijs.io/particle-emitter/examples/flameUneven.html, what would be a strategy I could use with behaviors to achieve this?

andrewstart commented 9 months ago

There is no concept of subemitters in this library, you would instead use two Emitters as subemitters controlled by your "super emitter" that you create.

tankorsmash commented 9 months ago

Thanks!

What in the 5.0.0 release made it easier to make that parent-sub1-sub2 emitter combination? It's not clear which of the behaviors listed would help with that. It probably exists (hence the earlier comment), but I'm missing a step!

edit: Ah, it might be that I need to create my own custom behavior and register it with Emitter.registerBehavior!

andrewstart commented 9 months ago

Yes, that's exactly it: you would make your own behavior that creates and manages another Emitter.

tankorsmash commented 9 months ago

Thanks again for your help!

On Sat, Nov 25, 2023, 11:45 PM Andrew Start @.***> wrote:

Yes, that's exactly it: you would make your own behavior that creates and manages another Emitter.

— Reply to this email directly, view it on GitHub https://github.com/pixijs/particle-emitter/issues/92#issuecomment-1826523294, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKANBTHU53DQB635O2VBH3YGLCQBAVCNFSM4GS6EGGKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBSGY2TEMZSHE2A . You are receiving this because you commented.Message ID: @.***>