Difference between revisions of "LlGetAgentSize"

From Second Life Wiki
Jump to: navigation, search
(moving the caveat up from Notes section, and corrections as suggested in VWR-5771)
Line 4: Line 4:
 
|func_footnote={{LSL Const|ZERO_VECTOR|vector|{{LSL VR|0.0|0.0|0.0}}}} is returned if '''id''' is not in the region or if it is not an avatar.
 
|func_footnote={{LSL Const|ZERO_VECTOR|vector|{{LSL VR|0.0|0.0|0.0}}}} is returned if '''id''' is not in the region or if it is not an avatar.
 
|func_desc
 
|func_desc
|return_text=that is the size of the requested avatar by '''id'''.
+
|return_text=that is the size of the bounding box of the requested avatar by '''id'''.
 
|spec
 
|spec
|caveats
+
|caveats=* The returned vector holds the size of the avatar's bounding box{{Footnote|1=In fact the returned height is much smaller than the bounding box height. The {{String|actual avatar height}} can be approximated by using a multiplier of 1.10 to 1.125. You can test this by changing a prim to with [[llSetScale]] and compare the size.|2=In fact the returned height is much smaller than the bounding box height. The {{String|actual avatar height}} can be approximated by using a multiplier of 1.10 to 1.125. You can test this by changing a prim to with llSetScale and compare the size.}}, of which only the height (z) varies. Width (x) and depth (y) are constant. (0.45m and 0.6m respectively).
 
|constants
 
|constants
 
|examples=
 
|examples=
Line 44: Line 44:
 
}</lsl>
 
}</lsl>
  
* The returned vector holds the size of the avatar's bounding box{{Footnote|1=In fact the returned height is much smaller than the bounding box height. The {{String|actual avatar height}} can be approximated by using a multiplier of 1.10 to 1.125. You can test this by changing a prim to with [[llSetScale]] and compare the size.|2=In fact the returned height is much smaller than the bounding box height. The {{String|actual avatar height}} can be approximated by using a multiplier of 1.10 to 1.125. You can test this by changing a prim to with llSetScale and compare the size.}}, of which only the height (z) varies. Width (x) and depth (y) are constant. (0.45m and 0.6m respectively).
 
 
|cat1
 
|cat1
 
|cat2=Avatar
 
|cat2=Avatar

Revision as of 13:43, 29 September 2009

Summary

Function: vector llGetAgentSize( key id );

Returns a vector that is the size of the bounding box of the requested avatar by id.

• key id avatar UUID that is in the same region

ZERO_VECTOR is returned if id is not in the region or if it is not an avatar.

Caveats

  • The returned vector holds the size of the avatar's bounding box[1], of which only the height (z) varies. Width (x) and depth (y) are constant. (0.45m and 0.6m respectively).
All Issues ~ Search JIRA for related Bugs

Examples

<lsl>//A simple script that makes a box hover above the owner's head. default {

   state_entry() {
       key owner = llGetOwner();
       vector pos = llList2Vector(llGetObjectDetails(owner, [OBJECT_POS]),0);
       vector agent = llGetAgentSize(owner);
       pos.z += 0.5 + agent.z / 2;//"pos" needs to be adjusted so it appears above the owner.
       if(agent)//makes sure it found the owner, a zero vector evaluates as false
           llSetPos(pos);
   }
   touch_start(integer num) {
       llResetScript();
   }
}</lsl>

Notes

  • This function is a good way to quickly test...
    • if an avatar is in the same region.
    • if a UUID known to be in the region is an avatar.

To use this function to test either case use as follows <lsl>if(llGetAgentSize(uuid)) {

   //uuid is an avatar in the region

} else {

   //uuid is not an avatar in the region

}</lsl>

See Also

Deep Notes

Search JIRA for related Issues

Footnotes

  1. ^ In fact the returned height is much smaller than the bounding box height. The "actual avatar height" can be approximated by using a multiplier of 1.10 to 1.125. You can test this by changing a prim to with llSetScale and compare the size.

Signature

function vector llGetAgentSize( key id );