// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Measure accumulated orientation travel // Not compiled or tested in-world // Setup: Put in your own rezzed test object. Rotate the actual model with Edit or server-side animation. Owner-touch starts a thirty-sample session; touch again ends early. // Stop / restore: Automatically stops after thirty samples. Disable/remove to stop; no scene properties are changed. // Notes: Viewer-only target omega may not appear. Motion over180 degrees between samples is ambiguous; this is not a turn counter. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Test on a spare copy first. integer active; integer samples; float began; rotation previous; float previousTime; float totalAngle; float peak; finish() { llSetTimerEvent(0.0); active=FALSE; llOwnerSay("Sampled angular travel degrees="+(string)(totalAngle*RAD_TO_DEG)+" peak degrees/sec="+(string)(peak*RAD_TO_DEG)); } default { touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; if(active) { finish(); return; } samples=0; began=llGetTime(); previous=llGetRot(); previousTime=llGetTime(); totalAngle=0.0; peak=0.0; active=TRUE; llSetTimerEvent(1.0); llOwnerSay("Measurement session started."); } timer() { if(!active)return; ++samples; rotation current=llGetRot(); float now=llGetTime(); float angle=llAngleBetween(previous,current); float dt=now-previousTime; totalAngle += angle; if(dt>0.0&&angle/dt>peak)peak=angle/dt; previous=current; previousTime=now; if(samples>=30)finish(); } changed(integer flags) { if(flags&CHANGED_OWNER)llResetScript(); } }