Skip to main content
Version: latest - a1.19.x βš–οΈ

Interacting with the Sun

How to integrate and communicate with the Sun and Light.

In nanos world, we allow the greatest possible customization to be made on your servers and packages. And to make it even easier, we've included some built-in functions in the game which helps integrating and customizing your Servers.

A very important concept in nanos world is the Sun. We provide some methods on World class which allows the scripters to, in few lines of codes, modify the current Time of Day, Sun Speed, Environment Colors and even change the Weather and Fog.

For the methods of interaction with the Sun exposed in the World to work, it is necessary that your Map is loaded with a sun that our API can identify it, and for that to be possible, we created the method World.SpawnDefaultSun().

Spawning the Default Sun​

Once you run the method World.SpawnDefaultSun(), the game will destroy all (Unreal) Actors with the tag Sun and will spawn a brand new Actor which contains a Directional Light, Sky Light, Fog, Clouds and some others components which you will be able to control with World methods.

tip

Because of that it is important to set all your Actors with Sun tag when creating Maps!

caution

Sometimes if you use SpawnDefaultSun() in some maps, you may notice you will end up with two Directional or Sky Lights, this means the Map wasn't configured with the Sun tags.

Interacting with the Sun​

It is possible to change Several aspects and settings from the Sun.

info

All methods available for customizing the Sun are listed in World Static Class page.

Some examples of methods are World.SetTime(hours, minutes) or World.SetFogDensity(density) which will change the current Time and the Fog, respectively.

Weather​

We provide some basic methods to change the Weather of the World. You can use the method World.SetWeather() to select from a predefined selection of Weathers, or create your own Weather using all the methods the World provides.

Weather Types​

Weather TypeSun IntensityFog Second DensityFog Height FalloffSun Light ColorSky Rayleigh ScatteringSun Temp. Multi.Sky Light IntensityWind
Clear1500.0050.2Color(1.0, 0.9, 0.8)Color(0.17, 0.41, 1.0)1.01.00.25
Rain100.0250.03Color(0.82, 0.9, 1.0)Color(0.73, 0.8, 1.0)2.00.31.0
Cloudy100.10.01Color(1.0, 0.9, 0.8)Color(0.73, 0.8, 1.0)1.250.20.3
Thunder-storm50.50.025Color(0.82, 0.9, 1.0)Color(0.73, 0.8, 1.0)2.00.253.0