Difference between revisions of "LlGetBoundingBox"

From Second Life Wiki
Jump to navigation Jump to search
m
(Think I'm done rewriting... god that took forever ~_~)
Line 6: Line 6:
|func_desc
|func_desc
|return_text=that is the bounding box of '''object''' relative to its root prim.<br/>Format: <code>[ (vector) {{HoverText|min_corner|vector min_corner;}}, (vector) {{HoverText|max_corner|vector max_corner;}} ]</code>
|return_text=that is the bounding box of '''object''' relative to its root prim.<br/>Format: <code>[ (vector) {{HoverText|min_corner|vector min_corner;}}, (vector) {{HoverText|max_corner|vector max_corner;}} ]</code>
|spec
|spec=
|caveats=*The reported box for objects and avatars is too small by 0.1 meter in all three dimensions, missing the physics tolerance buffer. This error is retained for backward script compatibility. Subtract <0.05, 0.05, 0.05> from min_corner and add <0.05, 0.05, 0.05> to max_corner for a corrected box.
The physical representation of an object is made up of the shape of the prims and avatars seated upon it. The bounding box is the smallest possible cuboid which can contain the physical representation of the object and have it's faces aligned to the region axises.
*For server 1.36 and up, the bounding box for an attachment is the avatar's bounding box ''with'' the 0.1 meter addition already applied.
|caveats=
** Attachment bounding boxes do ''not'' include any object the avatar is sitting on.
* Regardless if '''object''' is a non-root prim, the bounding box of the object is returned.
* Attachments have no bounding boxes of their own (as they have no physical interaction{{Footnote|[[Phantom]] and [[VolumeDetect]] do have physics interactions, which is why they still have bounding boxes.|Phantom and VolumeDetect do have physics interactions, which is why they still have bounding boxes.}}), instead the bounding box of the avatar is returned.
 
==== Server 1.36 and Beyond ====
* When an avatar sits on an object, the reported bounding box for the avatar is unchanged.
 
==== Before Server 1.36 ====
* The reported box for objects and avatars is too small by 0.1 meter in all three dimensions, missing the physics tolerance buffer. This error is retained for backward script compatibility. Subtract <0.05, 0.05, 0.05> from min_corner and add <0.05, 0.05, 0.05> to max_corner for a corrected box.
|constants
|constants
|examples=<lsl>default//An avatar bounding box ruler thingy
|examples=<lsl>default//An avatar bounding box ruler thingy
Line 36: Line 43:
|also_articles
|also_articles
|notes
|notes
|permission
|history=
|negative_index
===== Sitting in 1.36 =====
Avatars historically when they sit upon an object have been treated as part of the object, like a prim, even being assigned a link number (which can be used to detect and manipulate them to some extent). Unrelated to this, requesting the bounding box for a child prim of an object would return the bounding box for the entire object (unless it was an attachment, which point it would return the bounding box for the avatar). The first is something of a misfeature, the latter is an honest to goodness feature; the combination of these two lead to something interesting: Prior to 1.36 requesting the bounding box of an attachment while seated returned the bounding box for the object sat upon. It got reported as a bug {{JIRA|SVC-1174}}, and the behavior was changed in 1.36. The bounding box for the object sat upon is unchanged by 1.36, the avatar still counts. However when the bounding box for the seated avatar is requested it does not fall through to the object being sat upon.
|cat1=Physics
|cat1=Physics
|cat2
|cat2

Revision as of 21:00, 25 February 2010

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 its root prim.
Format: [ (vector) min_corner, (vector) max_corner ]

• key object group, avatar or prim UUID that is in the same region

The bounding box is for the entire link set, not just the requested prim.
Returns an empty list ([]) if object is not found.

Specification

The physical representation of an object is made up of the shape of the prims and avatars seated upon it. The bounding box is the smallest possible cuboid which can contain the physical representation of the object and have it's faces aligned to the region axises.

Caveats

  • Regardless if object is a non-root prim, the bounding box of the object is returned.
  • Attachments have no bounding boxes of their own (as they have no physical interaction[1]), instead the bounding box of the avatar is returned.

Server 1.36 and Beyond

  • When an avatar sits on an object, the reported bounding box for the avatar is unchanged.

Before Server 1.36

  • The reported box for objects and avatars is too small by 0.1 meter in all three dimensions, missing the physics tolerance buffer. This error is retained for backward script compatibility. Subtract <0.05, 0.05, 0.05> from min_corner and add <0.05, 0.05, 0.05> to max_corner for a corrected box.

Examples

<lsl>default//An avatar bounding box ruler thingy {

   state_entry()
   {
       llSetStatus(STATUS_PHANTOM, TRUE);
   }
   
   touch_start(integer total_number)
   {
       key target = llDetectedKey(0);
       list box = llGetBoundingBox(target);
       vector center = (llList2Vector(box, 0) + llList2Vector(box, 1)) * 0.5;
       vector size = llList2Vector(box, 1) - llList2Vector(box, 0);
       llSetPrimitiveParams([PRIM_POSITION, center, PRIM_SIZE, size]);
       llSetText("Name: " + llDetectedName(0) + ", UUID: " + (string)target + 
               "\nBounding Box Size: " + (string)size, <1.0, 1.0, 1.0>, 1.0);
   }
}</lsl>

See Also

Functions

•  llGetAgentSize

Deep Notes

History

Sitting in 1.36

Avatars historically when they sit upon an object have been treated as part of the object, like a prim, even being assigned a link number (which can be used to detect and manipulate them to some extent). Unrelated to this, requesting the bounding box for a child prim of an object would return the bounding box for the entire object (unless it was an attachment, which point it would return the bounding box for the avatar). The first is something of a misfeature, the latter is an honest to goodness feature; the combination of these two lead to something interesting: Prior to 1.36 requesting the bounding box of an attachment while seated returned the bounding box for the object sat upon. It got reported as a bug SVC-1174, and the behavior was changed in 1.36. The bounding box for the object sat upon is unchanged by 1.36, the avatar still counts. However when the bounding box for the seated avatar is requested it does not fall through to the object being sat upon.

Footnotes

  1. ^ Phantom and VolumeDetect do have physics interactions, which is why they still have bounding boxes.

Signature

function list llGetBoundingBox( key object );