Difference between revisions of "Object Size"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with '{{LSL Header}} ==Object Size== Reports the dimensions and footprint of a linkset. <lsl> default { state_entry() { float temp; list box = llGetBounding...')
 
m (<lsl> tag to <source>)
 
Line 5: Line 5:
Reports the dimensions and footprint of a linkset.
Reports the dimensions and footprint of a linkset.


<lsl>
<source lang="lsl2">
default
default
{
{
Line 26: Line 26:
}
}


</lsl>
</source>

Latest revision as of 08:13, 25 January 2015

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());
    }
}