// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Rest a child bounding box on root plane // Not compiled or tested in-world // Setup: Use a nonphysical ordinary child box or a mesh with representative bounds. Owner-touch applies/restores. // Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview. // Notes: Use a spare modifiable build. Saved state lives only in script memory. Computes projected box half-height from local scale and rotation. This is bounding-box placement, not mesh collision analysis. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer preview; vector home; default { state_entry() { home=llGetLocalPos(); } touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; if(llGetLinkNumber()<2||llGetStatus(STATUS_PHYSICS))return; preview=!preview; if(preview) { vector size=llGetScale(); rotation r=llGetLocalRot(); vector x=<1.0,0.0,0.0>*r; vector y=<0.0,1.0,0.0>*r; vector z=<0.0,0.0,1.0>*r; float half=(llFabs(x.z)*size.x+llFabs(y.z)*size.y+llFabs(z.z)*size.z)*0.5; vector p=home; p.z=half; llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POS_LOCAL,p]); } else { llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POS_LOCAL,home]); } } }