Zum Hauptinhalt springen
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โ€‹

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
NameTypeBeschreibung
weatherWeatherTypeweather to change
transition_timefloatfade time to completely change to new weather

GetWeatherModerateโ€‹

Gets the current weather

local ret = Sky.GetWeather()
Returns
TypeBeschreibung
WeatherTypeCurrent weather

SetCloudCoverageModerateโ€‹

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

Sky.SetCloudCoverage(cloud_coverage)
Parameters
NameTypeBeschreibung
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
NameTypeBeschreibung
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
NameTypeBeschreibung
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
NameTypeBeschreibung
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
NameTypeBeschreibung
including_weatherbooleanif to check for Weather Actor too
Returns
TypeBeschreibung
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
NameTypeBeschreibung
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
TypeBeschreibung
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
NameTypeBeschreibung
contrastfloatContrast multiplier of the sky

SetNightBrightnessModerateโ€‹

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

Sky.SetNightBrightness(brightness)
Parameters
NameTypeBeschreibung
brightnessfloatBrightness multiplier at night

SetOverallIntensityModerateโ€‹

The overall brightness of the shader

Sky.SetOverallIntensity(intensity)
Parameters
NameTypeBeschreibung
intensityfloatBrightness multiplier of the sky

SetSunAngleModerateโ€‹

Sets the Sun Angle

Sky.SetSunAngle(yaw, pitch)
Parameters
NameTypeBeschreibung
yawfloatYaw angle, in degrees
pitchfloatPitch angle, in degrees

SetSunLightIntensityModerateโ€‹

Sets the Sun Light Intensity

Sky.SetSunLightIntensity(intensity)
Parameters
NameTypeBeschreibung
intensityfloatThe new Sun Light Intensity

SetSunScaleModerateโ€‹

Sets the Sun Scale

Sky.SetSunScale(radius)
Parameters
NameTypeBeschreibung
radiusfloatThe new Sun Scale

Moonstatic functionsโ€‹

SetMoonAngleModerateโ€‹

Sets the Moon Angle

Sky.SetMoonAngle(yaw, pitch)
Parameters
NameTypeBeschreibung
yawfloatYaw angle, in degrees
pitchfloatPitch angle, in degrees

SetMoonGlowIntensityModerateโ€‹

Sets the Moon Glow Intensity

Sky.SetMoonGlowIntensity(glow_intensity)
Parameters
NameTypeBeschreibung
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
NameTypeBeschreibung
colorColorThe new Moon Light Color

SetMoonLightIntensityModerateโ€‹

Sets the Moon Light Intensity

Sky.SetMoonLightIntensity(intensity)
Parameters
NameTypeBeschreibung
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
NameTypeBeschreibung
colorColorThe new Moon Material Color

SetMoonPhaseModerateโ€‹

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

Sky.SetMoonPhase(phase)
Parameters
NameTypeBeschreibung
phasefloatRanges from 0-30

SetMoonScaleModerateโ€‹

Sets the Moon Scale

Sky.SetMoonScale(scale)
Parameters
NameTypeBeschreibung
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
NameTypeBeschreibung
textureImage PathThe new Moon Texture

SetMoonTextureRotationModerateโ€‹

Sets the Moon Texture Rotation

Sky.SetMoonTextureRotation(rotation)
Parameters
NameTypeBeschreibung
rotationfloatThe new Moon Texture Rotation

SetMoonVerticalOffsetModerateโ€‹

Sets the Moon Vertical Offset

Sky.SetMoonVerticalOffset(offset)
Parameters
NameTypeBeschreibung
offsetfloatThe new Moon Vertical Offset

Timestatic functionsโ€‹

GetTimeOfDayModerateโ€‹

Gets the current time

local hours, minutes, seconds = Sky.GetTimeOfDay()
Returns
TypeBeschreibung
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
NameTypeBeschreibung
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
NameTypeBeschreibung
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.