Add lights||doc135750

September 20, 2022

Format

 GameSettings:addLight(mainLightDir, mainLightColor, subLightColor, ambientLightColor, brightness, time, transition) 

Description

Add lighting effects according to the color, brightness and other attributes of the light.


Precautions

  • When more than one light information is added, the lights in the scene will switch to the light color of the corresponding time period according to the day length of the game, so as to achieve the change of ambient light between day and night.
  • The value range of the time parameter here is 0 ~ 23.999, which refers to the time value calculated by the ratio of the one-day duration of the scene in the editor game settings

Parameters

Variable name type Description
mainLightDir Vector3 The direction of the main light
mainLightColor Vector3 The color of the main light
subLightColor Vector3 the color of the sub light
ambientLightColor Vector3 ambient light color
brightness Vector3 brightness
time float The time to run, the value range is 0 ~ 23.999
transition float The speed of transition to the current light information, the value range is 0 ~ 1


Code Samples

Blockman.Instance().gameSettings:addLight(
{x=0,y=-1,z=0},{x=1,y=0,z=0},{x=1,y=0,z=0},{x=1,y=0,z=0},{x=1,y=0,z=0},5.0,1
)