Ir para o conteúdo principal
Version: latest - a1.172.0 ⚖️

🌅 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​

Atmosphere
ChangeWeatherChanges the Weather
GetWeather: WeatherTypeGets the current weather
SetCloudCoverageThe amount of coverage for the cloud layer, from a clear sky to overcast
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
SetSkyModeSets the Sky Mode
SetVolumetricCloudColorSets the Volumetric Cloud Color
Lifecycle
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
IsSpawned: booleanReturns if the Ultra Dynamic Sky was spawned
ReconstructReconstruct the Ultra Dynamic Sky Actor, forces most of the changes to be applied
Spawn: booleanReplaces all Sky/Sun actors with the Ultra Dynamic Sky Actor, to be able to use the functions from this page
Lighting
SetContrastA simple contrast boost for the sky material. Cannot affect volumetric clouds
SetNightBrightnessCan be used to scale the brightness of the sky and lighting, at night
SetOverallIntensityThe overall brightness of the shader
SetSunAngleSets the Sun Angle
SetSunLightIntensitySets the Sun Light Intensity
SetSunScaleSets the Sun Scale
Moon
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
Time
GetTimeOfDay: integer, integer, integerGets the current time
SetAnimateTimeOfDaySets whether or not to animate the time of day
SetTimeOfDaySets the current time

Atmospherestatic functions​

ChangeWeatherModerate​

Changes the Weather

Sky.ChangeWeather(weather, transition_time)
Parameters
NameTypeDescrição
weatherWeatherTypeweather to change
transition_timefloatfade time to completely change to new weather

GetWeatherModerate​

Gets the current weather

local ret = Sky.GetWeather()
Returns
TypeDescrição
WeatherTypeCurrent weather

SetCloudCoverageModerate​

The amount of coverage for the cloud layer, from a clear sky to overcast

Sky.SetCloudCoverage(cloud_coverage)
Parameters
NameTypeDescrição
cloud_coveragefloatFrom 0 (clear sky) to 10 (overcast)

SetFogModerate​

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
NameTypeDescrição
fog_percentage?float or nilFog amount, from 0 to 100, or nil to hand the fog back to the weather Default nil

SetSkyModeModerate​

Sets the Sky Mode

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

Sky.SetSkyMode(sky_mode)
Parameters
NameTypeDescrição
sky_modeSkyModeThe new Sky Mode

SetVolumetricCloudColorModerate​

Sets the Volumetric Cloud Color

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

Sky.SetVolumetricCloudColor(color)
Parameters
NameTypeDescrição
colorColorThe new Volumetric Cloud Color

Lifecyclestatic functions​

DestroyAllSkyModerate​

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()

IsSpawnedOptimal​

Returns if the Ultra Dynamic Sky was spawned

local ret = Sky.IsSpawned(including_weather)
Parameters
NameTypeDescrição
including_weatherbooleanif to check for Weather Actor too
Returns
TypeDescrição
booleanWhether the Ultra Dynamic Sky was spawned

ReconstructSlow​

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

Sky.Reconstruct()

SpawnSlow​

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
NameTypeDescrição
spawn_weather?booleanWhether or not to spawn the Weather Actor (to be able to use Weather related methods) Default false
find_existing?booleanWhether or not to try to find existing Sky & Weather Actors spawned in the map, using their references instead Default true
Returns
TypeDescrição
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

Lightingstatic functions​

SetContrastModerate​

A simple contrast boost for the sky material. Cannot affect volumetric clouds

Sky.SetContrast(contrast)
Parameters
NameTypeDescrição
contrastfloatContrast multiplier of the sky

SetNightBrightnessModerate​

Can be used to scale the brightness of the sky and lighting, at night

Sky.SetNightBrightness(brightness)
Parameters
NameTypeDescrição
brightnessfloatBrightness multiplier at night

SetOverallIntensityModerate​

The overall brightness of the shader

Sky.SetOverallIntensity(intensity)
Parameters
NameTypeDescrição
intensityfloatBrightness multiplier of the sky

SetSunAngleModerate​

Sets the Sun Angle

Sky.SetSunAngle(yaw, pitch)
Parameters
NameTypeDescrição
yawfloatYaw angle, in degrees
pitchfloatPitch angle, in degrees

SetSunLightIntensityModerate​

Sets the Sun Light Intensity

Sky.SetSunLightIntensity(intensity)
Parameters
NameTypeDescrição
intensityfloatThe new Sun Light Intensity

SetSunScaleModerate​

Sets the Sun Scale

Sky.SetSunScale(radius)
Parameters
NameTypeDescrição
radiusfloatThe new Sun Scale

Moonstatic functions​

SetMoonAngleModerate​

Sets the Moon Angle

Sky.SetMoonAngle(yaw, pitch)
Parameters
NameTypeDescrição
yawfloatYaw angle, in degrees
pitchfloatPitch angle, in degrees

SetMoonGlowIntensityModerate​

Sets the Moon Glow Intensity

Sky.SetMoonGlowIntensity(glow_intensity)
Parameters
NameTypeDescrição
glow_intensityfloatThe new Moon Glow Intensity

SetMoonLightColorModerate​

Sets the Moon Light Color, the color of the light the moon casts at night

Sky.SetMoonLightColor(color)
Parameters
NameTypeDescrição
colorColorThe new Moon Light Color

SetMoonLightIntensityModerate​

Sets the Moon Light Intensity

Sky.SetMoonLightIntensity(intensity)
Parameters
NameTypeDescrição
intensityfloatThe new Moon Light Intensity

SetMoonMaterialColorModerate​

Sets the Moon Material Color, which tints the moon texture

Call Reconstruct() afterwards to apply it

Sky.SetMoonMaterialColor(color)
Parameters
NameTypeDescrição
colorColorThe new Moon Material Color

SetMoonPhaseModerate​

Sets the Moon Phase, from new moon to full moon and back

Sky.SetMoonPhase(phase)
Parameters
NameTypeDescrição
phasefloatRanges from 0-30

SetMoonScaleModerate​

Sets the Moon Scale

Sky.SetMoonScale(scale)
Parameters
NameTypeDescrição
scalefloatThe new Moon Scale

SetMoonTextureSlow​

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
NameTypeDescrição
textureImage PathThe new Moon Texture

SetMoonTextureRotationModerate​

Sets the Moon Texture Rotation

Sky.SetMoonTextureRotation(rotation)
Parameters
NameTypeDescrição
rotationfloatThe new Moon Texture Rotation

SetMoonVerticalOffsetModerate​

Sets the Moon Vertical Offset

Sky.SetMoonVerticalOffset(offset)
Parameters
NameTypeDescrição
offsetfloatThe new Moon Vertical Offset

Timestatic functions​

GetTimeOfDayModerate​

Gets the current time

local hours, minutes, seconds = Sky.GetTimeOfDay()
Returns
TypeDescrição
integerHour of the day (0-23)
integerMinutes (0-59)
integerSeconds (0-59)

See also SetTimeOfDay.

SetAnimateTimeOfDayModerate​

Sets whether or not to animate the time of day

Sky.SetAnimateTimeOfDay(animate, day_length?, night_length?)
Parameters
NameTypeDescrição
animatebooleanWhether or not to animate the time of day
day_length?float or nilThe time (in minutes) from sunrise to sunset Default 30.0
night_length?float or nilThe time (in minutes) from sunset to sunrise Default 15.0

SetTimeOfDayModerate​

Sets the current time

Sky.SetTimeOfDay(hours, minutes, transition_time?)
Parameters
NameTypeDescrição
hoursintegerHour of the day (0-23)
minutesintegerMinutes (0-59)
transition_time?float or nilSeconds to smoothly transition to the new time, 0 to change immediately Default 0.0

See also GetTimeOfDay.

🚀 Events​

This class doesn't have own events.