// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Ray meets a plane // Not compiled or tested in-world // Setup: Put in a spare prim you own. Edit RAY_START, DIRECTION, PLANE_POINT and NORMAL. Touch for a result. // 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: This is pure geometry, not llCastRay; it does not query real objects or terrain. Direction length controls the reported parameter. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Owner-only calculation; no scene changes. vector RAY_START = <1.0, 2.0, 8.0>; vector DIRECTION = <0.5, 0.0, -1.0>; vector PLANE_POINT = <0.0, 0.0, 0.0>; vector NORMAL = <0.0, 0.0, 1.0>; default { touch_start(integer detectedCount) { if (llDetectedKey(0) != llGetOwner()) return; float denominator = DIRECTION * NORMAL; if (llFabs(denominator) < 0.000001) { llOwnerSay("Parallel ray or invalid normal."); return; } float t = ((PLANE_POINT - RAY_START) * NORMAL) / denominator; if (t < 0.0) { llOwnerSay("The plane is behind the ray."); return; } llOwnerSay("Intersection: " + (string)(RAY_START + DIRECTION * t)); } changed(integer change) { if (change & CHANGED_OWNER) llResetScript(); } }