Object Size

From Second Life Wiki
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());
    }
}