swift - SKLightNode's shadow doesn't hide sprites -


i'm working sklightnode , have sprites on screen. want sprites cast shadow depending on light's position, want sprites lit directly light shown , sprites behind sprites hidden.

i have code :

let light = sklightnode()  override func didmove(to view: skview) {             light.categorybitmask = 1     light.falloff = 1.0     light.shadowcolor = skcolor.black     light.zposition = 2     addchild(light) // add light      _ in 0...10     {         let object = skspritenode(imagenamed: "stone")         object.position = cgpoint(x: cgfloat.random(min: playablerect.minx, max: playablerect.maxx), y: cgfloat.random(min: playablerect.miny, max: playablerect.maxy))         object.shadowcastbitmask = 1         object.zposition = 2         addchild(object) // add 10 wall sprites     } } 

this results in : enter image description here

as can see, problem sprites in shadow aren't hidden.

when change walls' zposition 1 (lower light's zposition), have :

enter image description here

here hidden, still not good.

i read in old stackoverflow question 2015 spritekit not support kind of situation. still case ? anyway, there workaround ?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -