Weather Controller

Weather/time controller for environments

Classes:

WeatherController(send_world_command)

Controller for dynamically changing weather and time in an environment

class holoocean.weather.WeatherController(send_world_command)

Controller for dynamically changing weather and time in an environment

Parameters:

send_world_command (function) – Callback for sending commands to a world

Methods:

set_day_time(hour)

Change the time of day.

set_fog_density(density)

Change the fog density.

set_weather(weather_type)

Set the world's weather.

start_day_cycle(day_length)

Start the day cycle.

stop_day_cycle()

Stop the day cycle.

set_day_time(hour)

Change the time of day.

Daytime will change when tick() or step() is called next.

By the next tick, the lighting and the skysphere will be updated with the new hour.

If there is no skysphere, skylight, or directional source light in the world, this command will exit the environment.

Parameters:

hour (int) – The hour in 24-hour format: [0, 23].

set_fog_density(density)

Change the fog density.

The change will occur when tick() or step() is called next.

By the next tick, the exponential height fog in the world will have the new density. If there is no fog in the world, it will be created with the given density.

Parameters:

density (float) – The new density value, between 0 and 1. The command will not be sent if the given density is invalid.

set_weather(weather_type)

Set the world’s weather.

The new weather will be applied when tick() or step() is called next.

By the next tick, the lighting, skysphere, fog, and relevant particle systems will be updated and/or spawned to the given weather.

If there is no skysphere, skylight, or directional source light in the world, this command will exit the environment.

Note

Because this command can affect the fog density, any changes made by a change_fog_density command before a set_weather command called will be undone. It is recommended to call change_fog_density after calling set weather if you wish to apply your specific changes.

In all downloadable worlds, the weather is sunny by default.

If the given type string is not available, the command will not be sent.

Parameters:
  • weather_type (str) – The type of weather, which can be rain, cloudy, or

  • sunny.

start_day_cycle(day_length)

Start the day cycle.

The cycle will start when tick() or step() is called next.

The sky sphere will then update each tick with an updated sun angle as it moves about the sky. The length of a day will be roughly equivalent to the number of minutes given.

If there is no skysphere, skylight, or directional source light in the world, this command will exit the environment.

Parameters:

day_length (int) – The number of minutes each day will be.

stop_day_cycle()

Stop the day cycle.

The cycle will stop when tick() or step() is called next.

By the next tick, day cycle will stop where it is.

If there is no skysphere, skylight, or directional source light in the world, this command will exit the environment.