简体   繁体   中英

Can I emit particles on iOS with SpriteKit from a non-rectangular region?

I have a complex region (not a rectangle) on the screen from which I'd like to emit particles. Is this possible?

An emitter creates particles at a given point. You can influence the start position X and Y variance, allowing particles to be emitted at random location within a rectangle. Emitting particles limited to a non-rectangular area is not possible.

However you could use multiple emitters to approximate the shape or possibly a crop node to prevent particles from appearing outside of the shape.

Lastly and quite possibly there might still be a way, although costly. If you apply an action that runs on each particle you could determine if that particle is within the shape and possibly alter its position or remove it if it is outside. I say possibly because I don't know what influence one can have over individual particles using particle actions but it's worth giving it a try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM