Skip to main content
Version: bleeding-edge ๐Ÿฉธ

๐ŸŒ… Sky

Interact with built-in Sky & Weather system.

๐Ÿ—ฟStatic ClassClient Only๐Ÿง‘โ€๐Ÿ’ปAPI Source

nanos world natively integrates Ultra Dynamic Sky, one of best Unreal Marketplace Asset Packs, it provides a dynamic sky and weather solution for games!

Through the Sky class, we expose it's methods to allow customizing it's parameters in real time!

๐ŸŽ’ย Examplesโ€‹

Client/Index.lua
-- Spawns a new Ultra Dynamic Sky actor
Sky.Spawn()

-- Sets the time to 16:30
Sky.SetTimeOfDay(16, 30)

๐Ÿ—ฟย Static Functionsโ€‹

ReturnsNameDescription
ChangeWeatherChanges the Weather
DestroyAllSkyDestroys all Directional Lights, Sky Lights, Exponential Height Fogs, Volumetric Clouds, Sky Atmosphere, Ultra Dynamic Sky Actors and all Actors with the Sun Actor Tag from the Level
integer, integer, integerGetTimeOfDayGets the current time
WeatherTypeGetWeatherGets the current weather
booleanIsSpawnedReturns if the Ultra Dynamic Sky was spawned
ReconstructReconstruct the Ultra Dynamic Sky Actor, forces most of the changes to be applied
SetAnimateTimeOfDaySets whether or not to animate the time of day
SetCloudCoverageThe amount of coverage for the cloud layer, from a clear sky to overcast
SetContrastA simple contrast boost for the sky material. Cannot affect volumetric clouds
SetFogThe fogginess of the scene. The impact this has on fog density is scaled from the Fog Density category. With weather spawned it also pins the weather's fog to this value, so later weather changes keep it, until called with nil
SetMoonAngleSets the Moon Angle
SetMoonGlowIntensitySets the Moon Glow Intensity
SetMoonLightColorSets the Moon Light Color, the color of the light the moon casts at night
SetMoonLightIntensitySets the Moon Light Intensity
SetMoonMaterialColorSets the Moon Material Color, which tints the moon texture
SetMoonPhaseSets the Moon Phase, from new moon to full moon and back
SetMoonScaleSets the Moon Scale
SetMoonTextureSets the Moon Texture
SetMoonTextureRotationSets the Moon Texture Rotation
SetMoonVerticalOffsetSets the Moon Vertical Offset
SetNightBrightnessCan be used to scale the brightness of the sky and lighting, at night
SetOverallIntensityThe overall brightness of the shader
SetSkyModeSets the Sky Mode
SetSunAngleSets the Sun Angle
SetSunLightIntensitySets the Sun Light Intensity
SetSunScaleSets the Sun Scale
SetTimeOfDaySets the current time
SetVolumetricCloudColorSets the Volumetric Cloud Color
booleanSpawnReplaces all Sky/Sun actors with the Ultra Dynamic Sky Actor, to be able to use the functions from this page

Moderate

ChangeWeatherโ€‹

Changes the Weather
Sky.ChangeWeather(weather, transition_time)

Parameters

TypeParameterDefaultDescription
WeatherTypeweather Required parameter weather to change
floattransition_time Required parameter fade time to completely change to new weather

Moderate

DestroyAllSkyโ€‹

Destroys all Directional Lights, Sky Lights, Exponential Height Fogs, Volumetric Clouds, Sky Atmosphere, Ultra Dynamic Sky Actors and all Actors with the Sun Actor Tag from the Level
Sky.DestroyAllSky()

Moderate

GetTimeOfDayโ€‹

Gets the current time
local hours, minutes, seconds = Sky.GetTimeOfDay()

Returns

TypeDescription
integerHour of the day (0-23)
integerMinutes (0-59)
integerSeconds (0-59)

See also SetTimeOfDay.


Moderate

GetWeatherโ€‹

Gets the current weather
local ret = Sky.GetWeather()

Returns

TypeDescription
WeatherTypeCurrent weather

Optimal

IsSpawnedโ€‹

Returns if the Ultra Dynamic Sky was spawned
local ret = Sky.IsSpawned(including_weather)

Parameters

TypeParameterDefaultDescription
booleanincluding_weather Required parameter if to check for Weather Actor too

Returns

TypeDescription
booleanWhether the Ultra Dynamic Sky was spawned

Slow

Reconstructโ€‹

Reconstruct the Ultra Dynamic Sky Actor, forces most of the changes to be applied
Sky.Reconstruct()

Moderate

SetAnimateTimeOfDayโ€‹

Sets whether or not to animate the time of day
Sky.SetAnimateTimeOfDay(animate, day_length?, night_length?)

Parameters

TypeParameterDefaultDescription
booleananimate Required parameter Whether or not to animate the time of day
float or nilday_length?30.0
The time (in minutes) from sunrise to sunset
float or nilnight_length?15.0
The time (in minutes) from sunset to sunrise

Moderate

SetCloudCoverageโ€‹

The amount of coverage for the cloud layer, from a clear sky to overcast
Sky.SetCloudCoverage(cloud_coverage)

Parameters

TypeParameterDefaultDescription
floatcloud_coverage Required parameter From 0 (clear sky) to 10 (overcast)

Moderate

SetContrastโ€‹

A simple contrast boost for the sky material. Cannot affect volumetric clouds
Sky.SetContrast(contrast)

Parameters

TypeParameterDefaultDescription
floatcontrast Required parameter Contrast multiplier of the sky

Moderate

SetFogโ€‹

The fogginess of the scene. The impact this has on fog density is scaled from the Fog Density category. With weather spawned it also pins the weather's fog to this value, so later weather changes keep it, until called with nil
Sky.SetFog(fog_percentage?)

Parameters

TypeParameterDefaultDescription
float or nilfog_percentage?nil
Fog amount, from 0 to 100, or nil to hand the fog back to the weather

Moderate

SetMoonAngleโ€‹

Sets the Moon Angle
Sky.SetMoonAngle(yaw, pitch)

Parameters

TypeParameterDefaultDescription
floatyaw Required parameter Yaw angle, in degrees
floatpitch Required parameter Pitch angle, in degrees

Moderate

SetMoonGlowIntensityโ€‹

Sets the Moon Glow Intensity
Sky.SetMoonGlowIntensity(glow_intensity)

Parameters

TypeParameterDefaultDescription
floatglow_intensity Required parameter The new Moon Glow Intensity

Moderate

SetMoonLightColorโ€‹

Sets the Moon Light Color, the color of the light the moon casts at night
Sky.SetMoonLightColor(color)

Parameters

TypeParameterDefaultDescription
Colorcolor Required parameter The new Moon Light Color

Moderate

SetMoonLightIntensityโ€‹

Sets the Moon Light Intensity
Sky.SetMoonLightIntensity(intensity)

Parameters

TypeParameterDefaultDescription
floatintensity Required parameter The new Moon Light Intensity

Moderate

SetMoonMaterialColorโ€‹

Sets the Moon Material Color, which tints the moon texture

Call Reconstruct() afterwards to apply it
Sky.SetMoonMaterialColor(color)

Parameters

TypeParameterDefaultDescription
Colorcolor Required parameter The new Moon Material Color

Moderate

SetMoonPhaseโ€‹

Sets the Moon Phase, from new moon to full moon and back
Sky.SetMoonPhase(phase)

Parameters

TypeParameterDefaultDescription
floatphase Required parameter Ranges from 0-30

Moderate

SetMoonScaleโ€‹

Sets the Moon Scale
Sky.SetMoonScale(scale)

Parameters

TypeParameterDefaultDescription
floatscale Required parameter The new Moon Scale

Slow

SetMoonTextureโ€‹

Sets the Moon Texture

Set it to empty to restore the default. After setting it, you must call Sky.Reconstruct() to have it applied properly
Sky.SetMoonTexture(texture)

Parameters

TypeParameterDefaultDescription
Image Pathtexture Required parameter The new Moon Texture

Moderate

SetMoonTextureRotationโ€‹

Sets the Moon Texture Rotation
Sky.SetMoonTextureRotation(rotation)

Parameters

TypeParameterDefaultDescription
floatrotation Required parameter The new Moon Texture Rotation

Moderate

SetMoonVerticalOffsetโ€‹

Sets the Moon Vertical Offset
Sky.SetMoonVerticalOffset(offset)

Parameters

TypeParameterDefaultDescription
floatoffset Required parameter The new Moon Vertical Offset

Moderate

SetNightBrightnessโ€‹

Can be used to scale the brightness of the sky and lighting, at night
Sky.SetNightBrightness(brightness)

Parameters

TypeParameterDefaultDescription
floatbrightness Required parameter Brightness multiplier at night

Moderate

SetOverallIntensityโ€‹

The overall brightness of the shader
Sky.SetOverallIntensity(intensity)

Parameters

TypeParameterDefaultDescription
floatintensity Required parameter Brightness multiplier of the sky

Moderate

SetSkyModeโ€‹

Sets the Sky Mode

After setting it, you must call Sky.Reconstruct() to have it applied properly
Sky.SetSkyMode(sky_mode)

Parameters

TypeParameterDefaultDescription
SkyModesky_mode Required parameter The new Sky Mode

Moderate

SetSunAngleโ€‹

Sets the Sun Angle
Sky.SetSunAngle(yaw, pitch)

Parameters

TypeParameterDefaultDescription
floatyaw Required parameter Yaw angle, in degrees
floatpitch Required parameter Pitch angle, in degrees

Moderate

SetSunLightIntensityโ€‹

Sets the Sun Light Intensity
Sky.SetSunLightIntensity(intensity)

Parameters

TypeParameterDefaultDescription
floatintensity Required parameter The new Sun Light Intensity

Moderate

SetSunScaleโ€‹

Sets the Sun Scale
Sky.SetSunScale(radius)

Parameters

TypeParameterDefaultDescription
floatradius Required parameter The new Sun Scale

Moderate

SetTimeOfDayโ€‹

Sets the current time
Sky.SetTimeOfDay(hours, minutes, transition_time?)

Parameters

TypeParameterDefaultDescription
integerhours Required parameter Hour of the day (0-23)
integerminutes Required parameter Minutes (0-59)
float or niltransition_time?0.0
Seconds to smoothly transition to the new time, 0 to change immediately

See also GetTimeOfDay.


Moderate

SetVolumetricCloudColorโ€‹

Sets the Volumetric Cloud Color

This is only applied if SetSkyMode(SkyMode.VolumetricClouds) is set
Sky.SetVolumetricCloudColor(color)

Parameters

TypeParameterDefaultDescription
Colorcolor Required parameter The new Volumetric Cloud Color

Slow

Spawnโ€‹

Replaces all Sky/Sun actors with the Ultra Dynamic Sky Actor, to be able to use the functions from this page. Internally this calls Sky.DestroyAllSky() automatically
local ret = Sky.Spawn(spawn_weather?, find_existing?)

Parameters

TypeParameterDefaultDescription
booleanspawn_weather?false
Whether or not to spawn the Weather Actor (to be able to use Weather related methods)
booleanfind_existing?true
Whether or not to try to find existing Sky & Weather Actors spawned in the map, using their references instead

Returns

TypeDescription
booleantrue if an existing Ultra Dynamic Sky Actor was found in the map and its reference was used, false if a new one was spawned

๐Ÿš€ย Eventsโ€‹

This class doesn't have own events.