Spritekit SKLightNode : light collision detection

688 views Asked by At

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?

1

There are 1 answers

0
sangony On

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.