How to increase the size of an SKLightNode in iOS

890 Views Asked by At

I'm playing around with SKLightNodes and attempting to have an object (sun) shine light on anything around it. The problem is that when I add the SKLightNode to the sun node, the SKLightNode only appears in the very center of the sun. I've tried scaling the SKLightNode, but it seems to have no effect on the size or range of the SKLightNode. Here is how The SKLightNode is implemented.

  let light = SKLightNode()
                light.categoryBitMask = 1;
                light.falloff = 1;
                light.ambientColor = UIColor.whiteColor();
                light.setScale(50)
                star!.addChild(light)

If anyone has any input on how I can increase the effectiveness of the light source, I sure would appreciate it.

1

There are 1 best solutions below

0
On

I think the only way to increase the "size" of an SKLightNode is decreasing the falloff value. You must need to set some value between 0 and 1.0.

    // very bright
    light?.falloff = 0.1

    // a little less bright
    light?.falloff = 0.5

    // the default brightness
    light?.falloff = 1.0

    // a little darker
    light?.falloff = 2.0

    // very dark
    light?.falloff = 5.0