// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Evaluate a dwell-rise-dwell-return cam // Not compiled or tested in-world // Setup: Place in a spare owned prim. Set phase0..1 and positive lift. Touch for private results. // Stop / restore: Disable/remove; no scene properties change. // Notes: Each quarter of the revolution is assigned one stage. Uses cosine rise/return with zero endpoint velocity. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Planning only. float PHASE=0.35; float LIFT=1.0; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(PHASE<0.0||PHASE>1.0||LIFT<0.0) { llOwnerSay("Invalid phase/lift."); return; } float value; string stage; if(PHASE<0.25) { stage="low dwell"; value=0.0; } else if(PHASE<0.5) { stage="rise"; float t=(PHASE-0.25)*4.0; value=0.5*(1.0-llCos(PI*t)); } else if(PHASE<0.75) { stage="high dwell"; value=1.0; } else { stage="return"; float t=(PHASE-0.75)*4.0; value=0.5*(1.0+llCos(PI*t)); } llOwnerSay(stage+" lift="+(string)(LIFT*value)); } }