Lighting a SpriteKit SKEmitterNode

120 views Asked by At

I have a SpriteKit game in which there's an SKEmitterNode.

In the process of lighting the scene with an SKLightNode, I noticed that SKEmitterNode does not have the lightingBitMask property required for lighting. An SKSpriteNode, for example, is lighting-enabled like this:

spriteNode.lightingBitMask = 0b0001

The emitter particles are visible in the dark, which is undesirable. Instead, I'd like the particles to obey the light/dark difference.

Question: Is there a way to achieve this lighting effect with SKEmitterNode and SKLightNode?

Thank you!

1

There are 1 answers

0
Sergey On

I would try to make the SKEmitterNode a child of some SKSpriteNode (just 2x2 pixels). Then you can modify the lightingBitMask of this parent SKSpriteNode.