Difference between revisions of "LlGetAgentSize"
Jump to navigation
Jump to search
(Give a way to find the actual agent height.) |
|||
Line 36: | Line 36: | ||
** if an avatar is in the same region. | ** if an avatar is in the same region. | ||
** if a UUID known to be in the region is an avatar. | ** if a UUID known to be in the region is an avatar. | ||
To use this function to test either case use as follows | To use this function to test either case use as follows | ||
<lsl>if(llGetAgentSize(uuid)) { | <lsl>if(llGetAgentSize(uuid)) { | ||
Line 44: | Line 42: | ||
//uuid is not an avatar in the region | //uuid is not an avatar in the region | ||
}</lsl> | }</lsl> | ||
* The returned vector holds the size of the avatar's bounding box <sup>(*)</sup>, of which only the height (z) varies. Width (x) and depth (y) are constant. (0.45m and 0.6m respectively). | |||
''(*) In fact the returned height is much smaller than the bounding box height. It looks like the returned height is the height of the center of the avatar head above the ground/floor. To get the actual avatar height (counting shoes, and with a +/-3cm precision), add 0.17m (17cm).'' | |||
|cat1 | |cat1 | ||
|cat2=Avatar | |cat2=Avatar |
Revision as of 02:44, 12 November 2008
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: vector llGetAgentSize( key id );218 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Returns a vector that is the 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
Examples
<lsl>//A simple script that makes a box hover above the owner's head. default {
state_entry(integer i) { 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 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>
- The returned vector holds the size of the avatar's bounding box (*), of which only the height (z) varies. Width (x) and depth (y) are constant. (0.45m and 0.6m respectively).
(*) In fact the returned height is much smaller than the bounding box height. It looks like the returned height is the height of the center of the avatar head above the ground/floor. To get the actual avatar height (counting shoes, and with a +/-3cm precision), add 0.17m (17cm).
See Also
Functions
• | llGetObjectDetails | |||
• | llGetBoundingBox | |||
• | llGetAgentInfo | |||
• | llRequestAgentData |