// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Signed horizontal turn angle // Not compiled or tested in-world // Setup: Put in a spare prim you own. Edit FROM and TO direction vectors. Touch to see degrees. // Stop / restore: Disable or remove the script. It only reports to its owner and does not change prim properties. Reset clears its temporary state. // Notes: Ignores Z. Positive means counterclockwise viewed from above; a zero horizontal heading is rejected. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Owner-only calculation; no scene changes. vector FROM = <1.0, 0.0, 0.0>; vector TO = <-1.0, 1.0, 0.0>; default { touch_start(integer detectedCount) { if (llDetectedKey(0) != llGetOwner()) return; if ((FROM.x * FROM.x + FROM.y * FROM.y < 0.000001) || (TO.x * TO.x + TO.y * TO.y < 0.000001)) { llOwnerSay("Headings must be nonzero."); return; } float crossZ = FROM.x * TO.y - FROM.y * TO.x; float dot = FROM.x * TO.x + FROM.y * TO.y; llOwnerSay("Signed turn: " + (string)(llAtan2(crossZ, dot) * RAD_TO_DEG) + " degrees"); } changed(integer change) { if (change & CHANGED_OWNER) llResetScript(); } }