I'm building a game using sprite kit and I am running into an odd bug when adding a light node as a child to my main character. The bug seems to occur when the main character's node is close to a sprite node like a wall or floor.
I've played around with the light node all that I can and nothing seems to be helping.
Humanoid is my main character's sprite node. The below code is from the humanoid init. This is the only code that involves the light nodes as the light masks were set in the scene editor. The zPosition of the light is set to lower than anything else in the scene including the walls.
let light = SKLightNode()
light.categoryBitMask =
GameScene.CollisionTypes.humanoid.rawValue
light.lightColor = UIColor.white
light.shadowColor = UIColor.black
light.zPosition = -100
light.position = humanoid.anchorPoint
light.falloff = 5.0
light.ambientColor = UIColor.black
humanoid.addChild(light)
I would expect that this would make a light node that follows the player around and produces a fog of war like effect. Instead the result is very close to what I expected but theres glitches with the lighting in some areas.
(Link to images) https://drive.google.com/open?id=1SyDvS5YiGM-qOvFM_bel5Gm6xpfHXAVw