Light: lin_attenuation

lin_attenuation
  • get/set the linear component of the light's attenuation.

Type:

  • float number

Range:

  • 0.00 to 1.00
Note:
  • Linear attenuation is the straight 1 to 1 reduction of light intensity. 
Sample Code

################## get the light's linear attenuation
 
# 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 light's linear attenuation
light_falloff = light.lin_attenuation

Sample Code

################## set the light's linear attenuation
 
# 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 light's linear attenuation
light.lin_attenuation = 0.8