// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Project a point onto a building plane // Not compiled or tested in-world // Setup: Put in a spare prim you own. Set POINT, a point ON_PLANE, and the plane NORMAL; touch to calculate. // 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: NORMAL need not be normalized but must not be zero. The signed distance follows its direction. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Owner-only calculation; no scene changes. vector POINT = <3.0, 4.0, 5.0>; vector ON_PLANE = <0.0, 0.0, 1.0>; vector NORMAL = <0.0, 0.0, 1.0>; default { touch_start(integer detectedCount) { if (llDetectedKey(0) != llGetOwner()) return; if (llVecMag(NORMAL) < 0.000001) { llOwnerSay("Use a nonzero normal."); return; } vector n = llVecNorm(NORMAL); float height = (POINT - ON_PLANE) * n; llOwnerSay("Footprint: " + (string)(POINT - height * n) + "; signed height: " + (string)height); } changed(integer change) { if (change & CHANGED_OWNER) llResetScript(); } }