Weather
The Weather system allows you to manage weather conditions effectively even when the environment is set to "Weather" in the Environment panel.
Summary
Importing the module
Yahaha provides a built-in module for managing the Weather System.
To import this module, use the following code:
local weatherSystem = require("com.yahaha.sdk.graphics.WeatherUtils")
Properties
| Property | Type | Description |
|---|---|---|
| season | string | Sets the season for the scene (Spring, Summer, Autumn, Winter). |
| weather | string | Sets the weather (Clear, Cloudy, Foggy, Overcast, Rain, Snow, Hail, Thunderstorm, Dust Storm). |
| time | number | Sets the current time (0 to 24). |
| cloudCover | number | Indicates cloudiness (0 to 1). |
| precipitation | number | Sets the quantity of rain, snow, or hail (0 to 1). |
| windStrength | number | Sets wind strength (0 to 1). |
| fogIntensity | number | Controls fog density (0 to 1). |
| fogColor | color | Sets the color of fog. |
| sunriseTime | number | Sets sunrise time (0 to 24). |
| sunsetTime | number | Sets sunset time (0 to 24). |
| sunColor | color | Sets the color of sunlight. |
| moonPhase | string | Sets the moon phase (NewMoon, WaxingCrescent, FirstQuarter, WaxingGibbous, FullMoon, WaningGibbous, ThirdQuarter, WaningCrescent). |
| moonColor | color | Sets the color of moonlight. |
| aurorasExist | boolean | Determines if auroras are present (only effective between sunset and sunrise). |
| aurorasColor | color | Sets the color of auroras (only effective between sunset and sunrise). |
| enableSound | boolean | Enables or disables weather-related sound effects. |
Methods
Sets all available settings in the Weather panel.
Changes the weather type to rain.
Changes the weather type to thunderstorms.
Changes the weather type to snow.
SetColorProperty(propertyName, propertyValue)
Sets the color property for fogColor, sunColor, moonColor, and aurorasColor. propertyName: string propertyValue: table, color value
SetStringProperty(propertyName, propertyValue)
Sets the string property for season, weather, and moonPhase. propertyName: string propertyValue: string
SetBoolProperty(propertyName, propertyValue)
Set the boolean property of aurorasExist and enableSound. propertyName: string propertyValue: boolean
SetNumberProperty(propertyName, propertyValue)
Set the number property of time, cloudCover, precipitation, windStrength, fogIntensity, sunriseTime, and sunsetTime.
- propertyName: string
- propertyValue: number
Properties
season
string. Sets the season for the scene between Spring, Summer, Autumn, and Winter.
weather
string. Sets the weather for the scene. Enter Clear, Cloudy, Foggy, Overcast, Rain, Snow, Hail, Thunderstorm, Dust Storm.
time
number. Sets the present time for the scene between 0 to 24.
cloudCover
number. Sets how cloudy it is. A higher value indicates more cloudy weather. Ranges from 0 to 1.