Agent & Avatar
presence in Second Life
is represented by two entities: an agent
and an avatar
is a client's
presence within a simulator
. All users connect to a sim as an agent. An agent is not an avatar, though it is represented on the client by one. An agent can be an object creator
and/or a group
member. An agent "sees" the world through a camera
and has an avatar.
is a visual representation of an agent within Second Life; it is the body other users see and interact with. Avatars can wear clothing
, have bodypart
s, and constantly play animations
(if they didn't, they would just stand with their legs spread wide and their arms stretched out to the sides in a neutral position). Avatars can have attachments
and are affected by physics
The terms "agent" and "avatar" are often used interchangeably. While this is technically incorrect, even Linden Lab
has neglected the differences between these two entities when naming LSL's
, so it's more practical to make a page combining the two.
Q: How do I move an avatar to another position?
A: An avatar can be moved by calling llMoveToTarget in an attachment's script. You also can use either llMoveToTarget or llSetPos to move an avatar that's sitting on an object. llPushObject can be used to move avatars without the need for an attachment, however the function should not be used for malicious purposes - if the user does not know that he/she will be pushed, they have valid grounds to file an abuse report.
Q: How do I rotate an avatar to face a different direction or look at an object?
A: Unfortunately, as of SL 1.6, you can't. Currently, the only way to fake rotation is to have an avatar sit on an object and then rotate the object. Note however that there is no way to force an avatar to sit on an object; rather, they must do so by right-clicking on the object and selecting "sit" from the pie menu.
A2: Instead of forcing them to right-click->choose sit, you can go to the object's General tab and then under the drop down menu that says When Left-Clicked choose Sit on object. This will force a sit whenever a user touches an object.
Q: How do I find out whether an agent is sitting/flying/walking/in mouselook/etc?
A: See llGetAgentInfo.
A2: llGetAnimation can be used to detect some of these modes, but it will only return a single animation state, not the bitmask that llGetAgentInfo returns.