// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Sliding child drawer // Not compiled or tested in-world // Setup: Put in a nonphysical child drawer in its closed position. Change TRAVEL to the desired distance in meters. The child local X axis is its travel direction. // Stop / restore: Touch again to restore the captured closed position. Do not reset, remove, or relink while open. // Notes: The saved pose survives normal running but not script reset. Link-distance limits still apply. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Not compiled or tested in-world. float TRAVEL = 0.5; vector closed; vector travel; integer opened; default { state_entry() { closed = llGetLocalPos(); travel = * llGetLocalRot(); } touch_start(integer count) { if (llDetectedKey(0) != llGetOwner() || llGetLinkNumber() < 2) return; if (llGetStatus(STATUS_PHYSICS)) return; opened = !opened; vector target = closed; if (opened) target += travel; llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POS_LOCAL, target]); } }