Difference between revisions of "LlGetBoundingBox"

From Second Life Wiki
Jump to navigation Jump to search
(Added an example, although I am not sure if it is the best possible demonstration of the function.)
Line 9: Line 9:
|caveats
|caveats
|constants
|constants
|examples
|examples=<lsl>vector min = <1, 1, 1>;
 
default
{
    touch_start(integer total_number)
    {
        llSensor("", NULL_KEY, PASSIVE, 96.0, PI);
    }
 
    sensor(integer num_detected)
    {
        list box;
        integer i;
        for(i; i < num_detected; ++i)
        {
            box = llGetBoundingBox(llDetectedKey(i));
            if(llVecDist(llList2Vector(box, 0), llList2Vector(box, 1)) > llVecMag(min))
            {
                llOwnerSay(llDetectedName(i) + "'s diagonal is longer than " + (string)llVecMag(min) + " meters.");
            }
        }
    }
}</lsl>
 
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llGetAgentSize]]|}}
|also_functions={{LSL DefineRow||[[llGetAgentSize]]|}}

Revision as of 13:51, 16 June 2008

Summary

Function: list llGetBoundingBox( key object );
0.0 Forced Delay
10.0 Energy

Returns a list that is the bounding box of object relative to it's root prim.
Format: [ (vector) min_corner, (vector) max_corner ]

• key object Object or agent in the sim.

The bounding box is for the entire link set, not just the requested prim.

Examples

<lsl>vector min = <1, 1, 1>;

default {

   touch_start(integer total_number)
   {
       llSensor("", NULL_KEY, PASSIVE, 96.0, PI);
   }
   sensor(integer num_detected)
   {
       list box;
       integer i;
       for(i; i < num_detected; ++i)
       {
           box = llGetBoundingBox(llDetectedKey(i));
           if(llVecDist(llList2Vector(box, 0), llList2Vector(box, 1)) > llVecMag(min))
           {
               llOwnerSay(llDetectedName(i) + "'s diagonal is longer than " + (string)llVecMag(min) + " meters.");
           }
       }
   }
}</lsl>

See Also

Functions

•  llGetAgentSize

Deep Notes

Signature

function list llGetBoundingBox( key object );