// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Sun elevation and azimuth // Not compiled or tested in-world // Setup: Owner-touch a sundial or lighting-test prop. // Stop / restore: Remove/disable; the environment is read only. // Notes: Uses parcel sun direction and may differ from a viewer’s personal environment. Azimuth is undefined near directly overhead or below. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. default { touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; vector sun=llVecNorm(llGetSunDirection()); float z=sun.z; if(z>1.0)z=1.0; if(z< -1.0)z=-1.0; float elevation=llAsin(z)*RAD_TO_DEG; vector horizontal=; string azimuth="undefined near vertical"; if(llVecMag(horizontal)>0.001) { float a=llAtan2(sun.x,sun.y)*RAD_TO_DEG; if(a<0.0)a+=360.0; azimuth=(string)llRound(a)+" degrees"; } llOwnerSay("Sun elevation "+(string)elevation+" degrees; azimuth "+azimuth); } }