Environments
Environments, from the Environmental Enhancement Project (EEP), define the sky, water and day cycle. Regions and parcels have an environment, and each avatar can see an override on top of it.
Scripts can read the sun and moon positions, change a parcel’s or region’s environment where the owner allows it, and give a single avatar a temporary environment through an experience. Wind, water height and ground shape are separate region properties, not part of the environment.
Concepts
- Reading the environment
- Sun and moon
directionandrotationfor the parcel, falling back to the region’s; or for the region itself - Day length, day offset and time of day, each also region-wide
- Individual environment settings at a position
- Sun and moon
- Parcel and region environment
- Swap in a whole environment asset
- Change individual settings
- Both need the land rights to change the environment
- Per-avatar environment
- Inside an experience, a script can override what one avatar sees, or set individual settings for them, with a transition time
- The override is temporary
- Weather and ground
Wind, water height and the ground shape are region properties scripts can read
Functions and events
list | llGetEnvironment(vector pos, list params) |
vector | llGetSunDirection() |
vector | llGetMoonDirection() |
float | llGetTimeOfDay() |
integer | llReplaceEnvironment(vector position, string environment, integer track_no, integer day_length, integer day_offset) |
integer | llSetEnvironment(vector position, list params) |
integer | llReplaceAgentEnvironment(key agent_id, float transition, string environment) |
integer | llSetAgentEnvironment(key agent_id, float transition, list params) |
llSetEnvironment parameters
The SKY_* and WATER_* settings that scripts can read and set. See the constant groups below.
Scripting Details
list | llGetEnvironment(vector pos, list params)Returns a list containing the current environment parameters for the parcel or region at pos, retrieved in the order specified by params. |
vector | llGetSunDirection()Returns a normalized vector representing the current direction of the parcel's sun, taking altitude into account. Falls back to the region's sun direction if no custom parcel environment is set. |
rotation | llGetSunRotation()Returns a rotation representing the orientation applied to the sun on the current parcel and altitude track. Falls back to the region's sun rotation if no custom parcel environment is set. |
vector | llGetMoonDirection()Returns a normalized vector representing the current direction of the parcel's moon, taking altitude into account. Falls back to the region's moon direction if no custom parcel environment is set. |
rotation | llGetMoonRotation()Returns a rotation representing the orientation applied to the moon on the current parcel and altitude track. Falls back to the region's moon rotation if no custom parcel environment is set. |
vector | llGetRegionSunDirection()Returns a normalized vector representing the current direction of the region's sun, taking altitude into account. |
rotation | llGetRegionSunRotation()Returns a rotation representing the orientation applied to the sun at the region level, taking altitude track into account. |
vector | llGetRegionMoonDirection()Returns a normalized vector representing the current direction of the region's moon, taking altitude into account. |
rotation | llGetRegionMoonRotation()Returns a rotation representing the orientation applied to the moon at the region level, taking altitude track into account. |
integer | llGetDayLength()Returns an integer representing the number of seconds in the environmental day cycle applied to the current parcel. |
integer | llGetDayOffset()Returns an integer representing the offset duration (in seconds) added to calculate the current environmental time on this parcel. |
integer | llGetRegionDayLength()Returns an integer representing the total number of seconds in the region-wide day cycle. |
integer | llGetRegionDayOffset()Returns an integer representing the offset duration (in seconds) added to calculate the current environmental time for the region. |
float | llGetTimeOfDay()Returns a float with subsecond precision representing the elapsed seconds since parcel environmental midnight or region uptime (whichever is smaller). If the parcel's sun position is fixed, returns region uptime. |
float | llGetRegionTimeOfDay()Returns a float with subsecond precision representing the elapsed seconds since region environmental midnight or region uptime (whichever is smaller). If the region's sun position is fixed, returns region uptime. |
integer | llReplaceEnvironment(vector position, string environment, integer track_no, integer day_length, integer day_offset)Replaces the environment on the parcel containing position (or the entire region if position is <-1.0, -1.0, -1.0>) for the specified track_no. Modifies day_length and day_offset if specified. Requires edit permissions on the parcel or estate management rights. |
integer | llSetEnvironment(vector position, list params)Overrides the environmental settings at position for a parcel (or region if position is <-1.0, -1.0, z>) using the parameters in params. Passing an empty params list removes previous overrides. |
integer | llReplaceAgentEnvironment(key agent_id, float transition, string environment)Replaces the region and parcel environment seen by the specified agent_id as part of an experience, transitioning the settings over transition seconds. Passing NULL_KEY or an empty string for environment restores defaults. |
integer | llSetAgentEnvironment(key agent_id, float transition, list params)Sets an individual agent's environmental settings using the attributes in params over a duration of transition seconds. Must be used as part of an experience; passing an empty list removes overrides. |
Additional
llGetEnvironment— read-only and settable parametersENVIRONMENT_DAYINFO— day length, day offset and seconds since midnightSKY_SUN— sun rotation, scale, color, direction and lightingWATER_FOG— underwater fog color, density and modulation
llSetEnvironment,llReplaceEnvironmentand the per-avatar functions — return an error codeENV_OK— the change will be attemptedENV_NO_PERMISSIONS— the script lacks permissions to modify the environment hereENV_NOT_EXPERIENCE— attempted to change environments outside an experience
- Ground and weather
llGround— ground height below the primllGroundNormal— ground surface normalllGroundSlope— ground slopellGroundContour— direction with no change in elevationllWater— water heightllWind— wind velocity
Environment settings
Section titled “Environment settings”Constant groups EnvironmentParamReadOnly 28EnvironmentParam 23EnvironmentError 10
Related
Section titled “Related”See also Category Parcel AppearanceSL Wiki llSetEnvironment parametersPlanned Guide: changing and replacing an environment
See also Feature ExperienceCategory Region AppearanceFeature Parcels & Regions