// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Calculate a connecting-rod slider position // Not compiled or tested in-world // Setup: Place in a spare owned prim. Set rod length greater than crank radius and crank angle degrees. Touch for private results. // Stop / restore: Disable/remove; no scene properties change. // Notes: Ideal planar slider-crank; no offsets or joint thickness. This complements visual crank models with exact position math. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Planning only. float CRANK=1.0; float ROD=3.0; float ANGLE=60.0; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(CRANK<=0.0||ROD<=CRANK) { llOwnerSay("Need rod>crank>0."); return; } float a=ANGLE*DEG_TO_RAD; float y=CRANK*llSin(a); float x=CRANK*llCos(a)+llSqrt(ROD*ROD-y*y); llOwnerSay("SliderX="+(string)x+" rod angle degrees="+(string)(llAsin(-y/ROD)*RAD_TO_DEG)); } }