// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Hinge-centered child door // Not compiled or tested in-world // Setup: Use a nonphysical linked build. The door must be a child whose actual pivot is at the hinge (for example, a mesh with a hinge-centered origin). Put this script in that door while closed. A normal centered cube will spin around its middle. // Stop / restore: Touch once more to close before disabling or removing. Reset only while closed; the saved pose is held in script memory. // Notes: Rotation is about the door’s local Z axis. Does not change physics or provide access security. Do not relink while open. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Not compiled or tested in-world. rotation closed; integer opened; default { state_entry() { closed = llGetLocalRot(); if (llGetLinkNumber() < 2) llOwnerSay("Put this in a child door prim."); } touch_start(integer count) { if (llDetectedKey(0) != llGetOwner() || llGetLinkNumber() < 2) return; if (llGetStatus(STATUS_PHYSICS)) { llOwnerSay("Use a nonphysical build."); return; } opened = !opened; rotation target = closed; if (opened) target = llEuler2Rot(<0.0, 0.0, PI_BY_TWO>) * closed; llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL, target]); } }