// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Project a direction onto a spherical image // Not compiled or tested in-world // Setup: Place in a spare owned prim. Set DIRECTION; longitude seam lies on the negativeX axis. Touch for owner-only output. // Stop / restore: Remove/disable. The script calculates only; no scene properties change. // Notes: The poles have ambiguous longitude. This is one explicit mapping convention and may differ from a mesh UV layout. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Planning only. vector DIRECTION=<2.0,3.0,1.0>; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(llVecMag(DIRECTION)<0.000001) { llOwnerSay("Nonzero direction required."); return; } vector n=llVecNorm(DIRECTION); float z=n.z; if(z>1.0)z=1.0; if(z< -1.0)z=-1.0; float u=0.5+llAtan2(n.y,n.x)/TWO_PI; float v=0.5+llAsin(z)/PI; llOwnerSay("Spherical UV="+(string)); } }