I have been unsuccessful in getting a SKSpriteNode to cast a shadow AND also be made to disappear when going into a shadow from the same light source. I am able to do one of
I'v found some workaround (not sure it's useful for all situation, but in some): You can make two (or more - up to 32 as we know) different light sources and assign you sprites to them one by one (or by some groups). Then shadows will combine as we need - correctly.
SKLightNode* light1 = [SKLightNode new];
SKLightNode* light2 = [SKLightNode new];
... // init them equally
light1.categoryBitMask = 1;
light2.categoryBitMask = 2;
...
SKSpriteNode* sprite1 = ...
SKSpriteNode* sprite2 = ...
sp1.shadowCastBitMask = 1;
sp1.shadowedBitMask = 1;
sp2.shadowCastBitMask = 2;
sp2.shadowedBitMask = 2;
I just heard back from Apple Developer Technical Support confirming this is a bug in SpriteKit (SKLightNode). Currently they do not know of a workaround for this issue but will update me if one is found.
As per their request, I have filed a bug report.
UPDATE April 22, 2015
SK engineering confirmed that SpriteKit doesn't support shadow casting and shadowed on the same object. There is no workaround at present. This issue will be addressed at some point.
UPDATE December 15, 2015
Received a new response from Apple regarding this issue.
Apple Developer Relations 14-Dec-2015 01:35 PM
There are no plans to address this.
We are now closing this report.