Skip to content

WorldSun ​

Inherits: DirectionalLight3D

The sun of the game: a DirectionalLight3D that follows the game clock. Its PATH is a SunConfig (one per world), its LIGHT (brightness and colour by the hour, shadow softness, indirect and volumetric light) comes from the Sun Light groups of the EnvironmentConfig that is on now, so a zone or an event that changes the environment dims or warms the sun without moving it. See SunLook.

Variables ​

SunConfigcurrent_sun_config
EnvironmentConfigcurrent_lighting
ChronoManagerchrono_manager
boolday_night_cycletrue
floatweather_dim1.0

Methods ​

SunConfigget_sun_path()
voidupdate_sun_position( current_time: float )
voidupdate_light_energy( current_time: float )
voidupdate_light_color( current_time: float )
voidapply_sun_config( config: SunConfig )
voidapply_lighting( config: EnvironmentConfig )
voidset_weather_dim( brightness: float )

Variable descriptions ​

SunConfig current_sun_config ​

The path of the sun that is applied now

EnvironmentConfig current_lighting ​

The environment whose Sun Light groups the sun shines by now

ChronoManager chrono_manager ​

Chronomanager ref

bool day_night_cycle = true ​

Does the sun follow the clock? (false = a sun that stays where it is)

float weather_dim = 1.0 ​

How much of its light the sun gives while a weather dims it (1 = all of it, 0 = none: an overcast storm)

Method descriptions ​

SunConfig get_sun_path() ​

The path the sun follows now (what the sound reads to know when it is night)

void update_sun_position( current_time: float ) ​

Update the sun's position (and brightness and colour) based on the current game time

void update_light_energy( current_time: float ) ​

Update the light energy (brightness) based on time of day

void update_light_color( current_time: float ) ​

Update the light color based on time of day

void apply_sun_config( config: SunConfig ) ​

Apply a SunConfig: the path of the sun

void apply_lighting( config: EnvironmentConfig ) ​

Apply the Sun Light groups of an EnvironmentConfig: how bright and what colour the sun is, and its light properties

void set_weather_dim( brightness: float ) ​

A weather dims the sun (or lets it shine again): 1 = the light the look says