// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Predict closest approach of two moving points // Not compiled or tested in-world // Setup: Place in a spare owned prim. Set relative POSITION and VELOCITY. Touch for owner-only output. // Stop / restore: Remove/disable. The script calculates only; no scene properties change. // Notes: Negative closest time is clamped to now. Only supplied test vectors are used; no sensors or avatar data. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Planning only. vector POSITION=<10.0,4.0,0.0>; vector VELOCITY=<-2.0,-0.2,0.0>; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; float speed2=VELOCITY*VELOCITY; float t=0.0; if(speed2>0.000001)t=-(POSITION*VELOCITY)/speed2; if(t<0.0)t=0.0; llOwnerSay("Closest future time="+(string)t+" separation="+(string)llVecMag(POSITION+t*VELOCITY)); } }