Light: quad_attenuation

quad_attenuation
  • gets/sets the quadratic component of the light's attenuation.

Type:

  • float number

Range:

  • 0.00 to 1.00
Note:
  • Quadratic attenuation is the reduction of light intensity based on a quadratic equation. 
     
  • The farther you are from the light source the quicker the light intensity falls off.
Sample Code

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

Sample Code

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