vector llGetAgentSize(key id)
is in the same sim region
as the script calling this function
, it returns a vector
representing the size
of the avatar
. This is useful for approximating the height of the avatar. This function returns a ZERO_VECTOR
when the key is not an agent
or the agent is not in the sim.
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). While the size returned by this function does not change when the avatar sits
down (whether on an object or on the ground
), the bounding box returned by llGetBoundingBox
will change its size to include the object
the avatar is sitting on.
(*) The returned value is NOT in meters. To get the actual avatar height (counting shoes, and with a +/-3cm precision) you need to apply a factor of 1.125 (you can test this by changing a prim with llSetScale and compare the size).
In the official Second Life viewer, avatar height is not readily available, as such, no consistency has ever developed over avatar height. Some viewers do however report an adjusted value in the Edit Appearance window (avatar->mBodySize.mV[VZ] + 0.17 in Meerkat, Cool VL Viewer, Imprudence, Emerald; avatar->mBodySize.mV[VZ] + 0.195 in Snowglobe; see newview/llfloatercustomize.cpp in each release to verify the current formula in use). avatar->mBodySize.mV[VZ] is the number reported by llGetAgentSize.
An accurate measure of avatar height is best obtained by sizing a phantom prim to the value obtained by one of these adjustment methods and standing within it, then adjusting it to a more exact match; llGetAgentSize itself should never be considered accurate.
Q: Is there a way to automatically trigger a script when an avatar's size changes?
A: No. To do so, you'll need to use a timer, or some other kind of regular check. This can be laggy.
This article wasn't helpful for you? Maybe the related article at the LSL Portal
is able to bring enlightenment.