Does anyone know how to enable / disable the Enviroment Lighting option in the World panel on the UPBGE? I tried the following code but it didn’t work or gave an error on the console.
from bge import logic, events
controller = logic.getCurrentController()
owner = controller.owner
keyboard = logic.keyboard.inputs
if keyboard[events.BKEY].values[-1]:
WorldLighting.use_glsl_environment_lighting = False
from bge import logic, events
#controller = logic.getCurrentController()
#owner = controller.owner
scene = logic.getCurrentScene() # your scene
world = scene.world # the world in your scene
keyboard = logic.keyboard.inputs
if keyboard[events.BKEY].values[-1]:
world.envLightEnergy = 0.0 # the environment lighting energy set to 0
##### --- other variables...
# world.exposure = 0.5
# world.range = 0.3
# world.mistColor = (0.0,1.0,0.0) # turn mist green
# world.ambientColor = (1.0,1.0,0.0) # ambient color into yellow
# world.horizonColor = (1.0,0.0,0.0,1.0) # horizon color into red
# world.zenithColor = (0.0,0.0,2.0,1.0) # sky blue :)
# world.backgroundColor = (0.4,0.7,0.9)
# world.mistDistance = 800.0
# world.mistStart = 25.0
The environment light can’t be disabled directly though (I think), you could try turning the energy down to zero.
world = own.scene.world
world.envLightEnergy = 0
And you might have to disable constant settings for world on your materials for any changes to take effect. Like so, in material tab of properties panel.