5

I do not understand the difference between shadowedBitMask and shadowCastBitMask in SKSpriteNode of spritekit in objective-c for ios development.

in the documentation it says:

shadowedBitMask is defined as "To determine whether this sprite is affected by being a shadow generated by a light, its shadowCastBitMask property is tested against the light’s categoryBitMask property by performing a logical AND operation. If the comparison results in a non-zero value, then the sprite is drawn using a shadowed effect."

The default value is 0x00000000 (all bits cleared).

shadowCastBitMask = "To determine whether this sprite blocks the light (casting a shadow) the sprite’s shadowedBitMask property is tested against the light’s categoryBitMask property by performing a logical AND operation. If the comparison results in a non-zero value, then the sprite casts a shadow past itself."

could someone please rephrase or give me an example because I dont understand what shadowedBitMask does??

rmaddy
  • 314,917
  • 42
  • 532
  • 579
the pickle
  • 668
  • 8
  • 18

1 Answers1

5

shadowCastBitMask will set if the light creates a shadow with that object.

shadowedBitMask will set if the object receives a shadow from the objects that cast one.

Let's not forget that the light must be higher in the zPosition to cast a shadow on another item.

Tokuriku
  • 1,332
  • 13
  • 22
  • In practice, I could not get results when use the shadowedBitMask, i have the SKLightNode and 2 SKSpriteNode and for all values of the shadowedBitMask, it does not give any result with the shadow of one object cover the another. There are also some questions that remain unanswered - http://stackoverflow.com/questions/28662600/sklightnode-cast-shadow-issue. Could you give an example of code in which shadowedBitMask gives the result? – Alexey Pichukov Feb 27 '15 at 09:47