// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Gentle pendulum exhibit // Not compiled or tested in-world // Setup: Use a nonphysical build with a child whose pivot is at its suspension point. Put the script in that child at rest, then owner-touch to start. Swing axis is the child’s local Y. // Stop / restore: Owner-touch to restore the resting rotation before deleting or resetting. // Notes: This is a driven display, not a physics simulation. A centered prim swings around its center. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Not compiled or tested in-world. rotation home; integer active; default { state_entry() { home = llGetLocalRot(); } touch_start(integer count) { if (llDetectedKey(0) != llGetOwner() || llGetLinkNumber() < 2) return; if (llGetStatus(STATUS_PHYSICS)) return; active = !active; if (active) { llResetTime(); llSetTimerEvent(0.2); } else { llSetTimerEvent(0.0); llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL, home]); } } timer() { if (llGetLinkNumber() < 2 || llGetStatus(STATUS_PHYSICS)) { llSetTimerEvent(0.0); active = FALSE; return; } rotation swing = llEuler2Rot(<0.0, 0.3 * llSin(llGetTime()), 0.0>); llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL, swing * home]); } }