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 } }
as can see, problem sprites in shadow aren't hidden.
when change walls' zposition 1 (lower light's zposition), have :
here hidden, still not good.
i read in old stackoverflow question 2015 spritekit not support kind of situation. still case ? anyway, there workaround ?
Comments
Post a Comment