Hello everyone,
We’re thrilled to announce new LUA api that enhance our product’s functionality: the SkySystemAPI, WeatherSystemAPI, and PostProcessAPI! These tools will allow you to create dynamic and immersive environments in your projects.
1. SkySystemAPI
The SkySystemAPI enables you to control various parameters of the Sky and SunLight when the System is set to Sky in the Environment panel.
Key Properties:
Property Name | Type | Range | Sample Code | In-game Effect |
---|---|---|---|---|
SunActive | boolean | true/false | skySystem.SunActive = false |
Turns off sunlight |
SunBrightness | number | 0-10 | skySystem.SunBrightness = 0 |
Sets Sun brightness |
SunColor | Color | / | skySystem.SunColor = skySystem.SunColor + Color.New(0.002,0,0,0) |
Gradually changes Sun color |
SunRotation | Vector3 | / | skySystem.SunRotation = Vector3.New(0, 90, 0) |
Sets Sun rotation |
SunShadowEnabled | boolean | true/false | / | Enables/Disables shadows |
SunShadowIntensity | number | 0-1 | / | Adjusts shadow intensity |
SkyRotation | number | 0-360 | skySystem.SkyRotation = skySystem.SkyRotation + 1 |
Rotates sky box |
SkyColor | Color | / | / | Adjusts sky color |
SkyExposure | number | 0-1 | / | Adjusts sky exposure |
SkyBrightness | number | 0-1 | / | Adjusts sky brightness |
2. WeatherSystemAPI
The WeatherSystemAPI allows you to manage weather conditions and is effective even when the System is set to Sky in the Environment panel.
Key Properties:
Property Name | Type | Range | Sample Code | In-game Effect |
---|---|---|---|---|
season | string | Spring, Summer, Autumn, Winter | / | Sets the current season |
weather | string | Clear, Cloudy, Foggy, etc. | weatherSystem.SetStringProperty("weather", "Snow") |
Changes weather to Snow |
time | number | 0-24 | weatherSystem.SetNumberProperty("time", 24) |
Sets game time |
cloudCover | number | 0-1 | / | Adjusts cloud cover |
precipitation | number | 0-1 | / | Adjusts precipitation level |
windStrength | number | 0-1 | / | Adjusts wind strength |
fogIntensity | number | 0-1 | / | Adjusts fog intensity |
fogColor | Color | / | weatherSystem.SetColorProperty("fogColor", Color.New(1,1,1,1)) |
Sets fog color |
sunriseTime | number | 0-24 | / | Sets sunrise time |
sunsetTime | number | 0-24 | / | Sets sunset time |
sunColor | Color | / | / | Adjusts sunlight color |
moonPhase | string | Various phases | / | Sets moon phase |
moonColor | Color | / | / | Adjusts moon color |
3. PostProcessAPI
The PostProcessAPI allows for advanced visual effects through post-processing properties in the Environment settings.
Key Properties:
PostProcess Name | Property Name | Type | Range | Sample Code | In-game Effect |
---|---|---|---|---|---|
Bloom | Active | boolean | true/false | PostProcessSystem.SetPostProcessValue("Bloom", "Active", true) |
Enables bloom effect |
Intensity | number | 0-15 | PostProcessSystem.SetPostProcessValue("Bloom", "Intensity", 1) |
Adjusts bloom intensity | |
Color | Color | / | PostProcessSystem.SetPostProcessValue("Bloom", "Color", Color.New(1,0,0,1)) |
Changes bloom color | |
Vignette | Active | boolean | true/false | / | Enables vignette effect |
Intensity | number | 0-1 | / | Adjusts vignette intensity | |
Fog | Active | boolean | true/false | / | Enables fog effect |
Density | number | 0-10 | / | Adjusts fog density |
Example Usage
Here’s a simple example of using the WeatherSystemAPI to set a snowy environment:
local weatherSystem = require("com.yahaha.sdk.graphics.WeatherUtils")
script.OnStart(function ()
local weatherSetting = {
season = "Winter",
weather = "Snow",
time = 23,
cloudCover = 0.3,
precipitation = 0.8,
windStrength = 0.3,
fogIntensity = 0,
fogColor = Color.New(1,1,1,1),
sunriseTime = 7.5,
sunsetTime = 17.5,
sunColor = Color.New(1,1,1,1),
moonPhase = "FullMoon",
moonColor = Color.New(1,1,1,1),
aurorasExist = true,
aurorasColor = Color.New(0,0.5,0,1)
}
weatherSystem.SetWeather(weatherSetting)
end)
Get Started!
Explore these APIs in your projects and see how they enhance your environments. If you have any questions or feedback, please reach out—we’re excited to see what you create!
Happy developing!