1

My question is how to detect if any of sprites in the scene is affected by light node.

Didn`t found anything related to this issue. Is there some delegate method like didBeginContact for SKLightNode?

sangony
  • 11,636
  • 4
  • 39
  • 55
Alex Shuraits
  • 432
  • 1
  • 5
  • 14

1 Answers1

3

When you create a SKLightNode you set its categoryBitMask just as you would with physics bodies.

SKSpriteNode has a lightingBitMask property which you can set to determine whether this sprite is lit by a light node or not.

SKSpriteNode has additional properties regarding SKLightNode such as shadowCastBitMask and shadowedBitMask which deal with the sprite casting a shadow and being hidden inside a shadow.

Be aware though that the SKLightNode currently has a confirmed bug. Look at this SO question for more information.

Community
  • 1
  • 1
sangony
  • 11,636
  • 4
  • 39
  • 55