Object Size

From Second Life Wiki
Revision as of 07:13, 25 January 2015 by ObviousAltIsObvious Resident (talk | contribs) (<lsl> tag to <source>)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Object Size

Reports the dimensions and footprint of a linkset.

default
{
    state_entry()
    {
        float temp;

        list box = llGetBoundingBox(llGetKey());
        vector size = llList2Vector(box, 1) * llGetRot() - llList2Vector(box, 0) * llGetRot();

        if (llAbs(llRound(size.x)) < llAbs(llRound(size.y))) {
            float temp = size.y;
            size.y = size.x;
            size.x = temp;
        }
        llOwnerSay("Your object is roughly " + (string)llAbs(llRound(size.x)) + "m long by " + (string)llAbs(llRound(size.y)) + "m wide by " + (string)llAbs(llRound(size.z)) + "m tall.");
        llOwnerSay("With an area of " + (string)llAbs(llRound(size.x*size.y)));
        llRemoveInventory(llGetScriptName());
    }
}