Difference between revisions of "LlLinkSitTarget"

From Second Life Wiki
Jump to navigation Jump to search
m (+also-functions)
m (grrr)
Line 3: Line 3:
|func_id=?|func_sleep=0.0|func_energy=10.0
|func_id=?|func_sleep=0.0|func_energy=10.0
|sort
|sort
|func=LlLinkSitTarget
|func=llLinkSitTarget
|p1_type=integer|p1_name=link|
|p1_type=integer|p1_name=link|
|p2_type=vector|p2_name=offset|p2_desc=Additional position for the sit target in local prim coordinates.
|p2_type=vector|p2_name=offset|p2_desc=Additional position for the sit target in local prim coordinates.

Revision as of 01:56, 23 December 2011

Summary

Function: llLinkSitTarget( integer link, vector offset, rotation rot );

Set the sit location for the linked prim(s). The sit location is relative to the prim's position and rotation.

• integer link Link number (0: unlinked, 1: root prim, >1: child prims and seated avatars) or a LINK_* flag
• vector offset Additional position for the sit target in local prim coordinates.
• rotation rot Additional rotation for the sit target relative to the prim rotation.

If offset == <0.0, 0.0, 0.0> then the sit target is removed.

Specification

llLinkSitTarget sets the position for the Agent Target (Develop -> Character -> View Agent Target). The position of the target is based on rot and the offset[2].

Flag Description
LINK_ROOT 1 refers to the root prim in a multi-prim linked set[1]
LINK_SET -1 refers to all prims
LINK_ALL_OTHERS -2 refers to all other prims
Flag Description
LINK_ALL_CHILDREN -3 refers to all children, (everything but the root)
LINK_THIS -4 refers to the prim the script is in

Caveats

  • Once a sit target is removed llAvatarOnLinkSitTarget will only return NULL_KEY.
  • Removing or deactivating the script that sets the sit target will not remove the prim's sit target.
    • Sit target is a prim property and not dependent on a script for its continued existence.
  • To remove sit target, use the following:

<lsl>llLinkSitTarget(linkNum, ZERO_VECTOR, ZERO_ROTATION);</lsl>

  • There is no way to remove the Sit option from the pie menu. It will appear to be removed if the llSetSitText is set to a space " " or similar transparent string.
  • Attachments cannot be sat upon (see SVC-6100 to vote for such a feature).
  • rot affects the position of the sit-target in a buggy way. To correct for the rot bug, simply subtract <0,0,0.4> from the position when rot is zero. See example in llSitTarget.
    • llSetLinkPrimitiveParams is a more difficult workaround.
    • Animations are relative to the Agent Target, but the Agent Target isn't described by the animation.
  • llSitTarget does not update position of an already seated avatar. See UpdateSitTarget for a way to do this.
  • offset is limited to 300.0 meters on each axis. The x, y and z components must be in the range [-300, 300.0][3].
    • If they are outside the acceptable range they are rounded to the closest limit.
All Issues ~ Search JIRA for related Bugs

Examples

Notes

Link Numbers

Each prim that makes up an object has an address, a link number. To access a specific prim in the object, the prim's link number must be known. In addition to prims having link numbers, avatars seated upon the object do as well.

  • If an object consists of only one prim, and there are no avatars seated upon it, the (root) prim's link number is zero.
  • However, if the object is made up of multiple prims or there is an avatar seated upon the object, the root prim's link number is one.

When an avatar sits on an object, it is added to the end of the link set and will have the largest link number. In addition to this, while an avatar is seated upon an object, the object is unable to link or unlink prims without unseating all avatars first.

Counting Prims & Avatars

There are two functions of interest when trying to find the number of prims and avatars on an object.

integer GetPrimCount() { //always returns only the number of prims
    if(llGetAttached())//Is it attached?
        return llGetNumberOfPrims();//returns avatars and prims but attachments can't be sat on.
    return llGetObjectPrimCount(llGetKey());//returns only prims but won't work on attachments.
}
See llGetNumberOfPrims for more about counting prims and avatars.

Errata

If a script located in a child prim erroneously attempts to access link 0, it will get or set the property of the linkset's root prim. This bug (BUG-5049) is preserved for broken legacy scripts.

See Also

Events

•  changed

Functions

•  llGetLinkNumber Returns the link number of the prim the script is in.
•  llSitTarget
•  llSetSitText
•  llAvatarOnSitTarget
•  llAvatarOnLinkSitTarget
•  llUnSit

Deep Notes

History

  • Scheduled for RC Magnum channel, week of August 3, 2011.
Search JIRA for related Issues

Footnotes

  1. ^ LINK_ROOT does not work on single prim objects. Unless there is an avatar sitting on the object.
  2. ^ It is widely considered that the rot should not affect the position, unfortunately the sit target code is a "Wikipedia logo"lava-flow. ~ SVC-2277
  3. ^ The ranges in this article are written in Interval Notation.

Signature

function void llLinkSitTarget( integer link, vector offset, rotation rot );