Light: layer

layer
  • gets/sets the layer on which this light will illuminate objects.

Type:

  • integer
     
  • 1 = layer 1
     
  • 2 = layer 2
     
  • 3 = layer 2 and 1
     
  • 4 = layer 3
     
  • 5 = layer 3 and 1
     
  • 6 = layer 3 and 2
     
  • 7 = layer 3 and 2 and 1
     
  • 8 = layer 4
     
  • etc.
     
  • 16 = layer 5
     
  • etc.
     
  • 32 = layer 6
     
  • etc.
     
  • 64 = layer 7
     
  • etc.
     
  • 128 = layer 8
     
  • etc.
     
  • 256 = layer 9
     
  • etc.
     
  • 512 = layer 10
     
  • etc.
     
  • 1024 = layer 11
     
  • etc.
     
  • 2048 = layer 12
     
  • etc.
     
  • 4096 = layer 13
     
  • etc.
     
  • 8192 = layer 14
     
  • etc.
     
  • 16384 = layer 15
     
  • etc.
     
  • 32768 = layer 16
     
  • etc.
     
  • 65536 = layer 17
     
  • etc.
     
  • 131072 = layer 18
     
  • etc.
     
  • 262144 = layer 19
     
  • etc.
     
  • 524288 = layer 20
     
  • etc.
Note:
  • A light can illuminate more than one layer.
Sample Code

################## get layer on which this light will illuminate objects.

# import bge
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get a list of the lights in the scene
lightList = scene.lights

# get light named TableLamp
light = lightList["TableLamp"]

# get the layer on which this light will illuminate objects.
layer_mask = light.layer

Sample Code

################## set the layer on which this light will illuminate objects.

# import bge
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get a list of the lights in the scene
lightList = scene.lights

# get light named TableLamp
light = lightList["TableLamp"]

# set the layer mask on which this light will illuminate objects.
light.layer = 4