llGetAgentSize

From Second Life Wiki
Revision as of 14:54, 15 January 2010 by Strife Onizuka (talk | contribs) (links links and links :P)
Jump to navigation Jump to search

Summary

Function: vector llGetAgentSize( key id );
0.0 Forced Delay
10.0 Energy

Returns a vector that is an estimated size 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 is an estimate calculated from the avatar's current shape including shoes. x is a constant 0.45[1], y is a constant 0.60[2], z is smaller than the rendered height by a fixed amount. Add .17 to z for crown to sole standing height, or add .195 for crown to floor (standing avatars are rendered slightly above the floor or ground).[3]
  • The return value is the same width and depth but 0.05 meters shorter than the avatar's bounding box when standing. An avatar's bounding box changes when an avatar sits, while llGetAgentSize is constant for as long as the shape does not change.

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

Footnotes

Signature

function vector llGetAgentSize( key id );