Attaches the scripted object at the specified attachment point to the avatar it has PERMISSION_ATTACH for. Even though users other than the owner can grant this permission, attaching to them will fail with the message “Script trying to attach to someone other than owner!“.
An object must have permission to attach itself. Call llGetPermissions to see if the object has the PERMISSION_ATTACH permission; if it doesn’t, llRequestPermissions must first be called to request permissions from the user.
The attach event is called with the avatar’s key.
Once an object is attached to the avatar, certain script functionality is disabled. See attachment for more details.
- If there is already an attachment at the attachment point, it will be detached and replaced with the new one.
- The attachment points are (usually) centered on the body part. If an object has not been attached before, it attaches at <0,0,0> offset from the attachment point. If the object has been attached before, it remembers its last attachment offset.
- Attachment points are relative to the object’s skeleton, not its surface. This can cause some attachments to look weird. ATTACH_RPEC and ATTACH_LPEC are examples of attachment points with high levels of surface/skeleton drift.
The attachment parameter can be one of the following constants (also integers):
|?||0||attach to last used attachment spot, like when you select Wear (default is right hand)|
|ATTACH_CHEST||1||chest/sternum – ATTACH_LBOOBIE and ATTACH_RBOOBIE don’t exist, though there’s ATTACH_RPEC and ATTACH_LPEC|
|ATTACH_RUARM||18||right upper arm|
|ATTACH_RLARM||19||right lower arm|
|ATTACH_LUARM||20||left upper arm|
|ATTACH_LLARM||21||left lower arm|
|ATTACH_RULEG||24||right upper leg|
|ATTACH_RLLEG||25||right lower leg|
|ATTACH_LULEG||26||left upper leg|
|ATTACH_LLLEG||27||left lower leg|
|ATTACH_LPEC||30||left pectoral – as noted above, ATTACH_RPEC and ATTACH_LPEC don’t always look like they’re attached to the right and left side of the chest, and will appear to float around a little.|
|ATTACH_HUD_CENTER_2||31||HUD Center 2|
|ATTACH_HUD_TOP_RIGHT||32||HUD Top Right|
|ATTACH_HUD_TOP_LEFT||34||HUD Top Left|
|ATTACH_HUD_BOTTOM_LEFT||36||HUD Bottom Left|
|ATTACH_HUD_BOTTOM_RIGHT||38||HUD Bottom Right|
A: llAttachToAvatar is used for objects that already exist in-world. Objects in your inventory can be thought of as being in an inert, suspended state. They don’t actually “exist” until you rez them.
A: You always must request permissions, but some permissions are auto-granted upon request for attachment or sit. BW