Difference between revisions of "LlLinkSitTarget"

From Second Life Wiki
Jump to navigation Jump to search
m (added date of release)
m
Line 4: Line 4:
|sort
|sort
|func=llLinkSitTarget
|func=llLinkSitTarget
|p1_type=integer|p1_name=link|
|p1_type=integer|p1_subtype=link|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.
|p3_type=rotation|p3_name=rot|p3_desc=Additional rotation for the sit target relative to the prim rotation.
|p3_type=rotation|p3_name=rot|p3_desc=Additional rotation for the sit target relative to the prim rotation.

Revision as of 00:16, 25 December 2013

Summary

Function: llLinkSitTarget( integer link, vector offset, rotation rot );
0.0 Forced Delay
10.0 Energy

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 -> Avatar -> Display Agent Target in the version 3.x viewer, Develop -> Character -> View Agent Target in older viewers). 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]
Flag Description
LINK_THIS -4 refers to the prim the script is in

Caveats

  • link needs to be either an actual link number or a link constants that equate to a single prim, such as LINK_ROOT and LINK_THIS.
  • 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.
  • If an object has multiple seats (each seat has a script that sets a sit target with llSitTarget, or the linkset has a script that assigns several llLinkSitTargets), the following method determines which sit target an avatar ends up at:
    • If the prim that is clicked on has a sit target and that sit target is not full, that sit target is used.
    • If the prim that is clicked on has no sit target, and one or more other linked prims have sit targets that are not full, the sit target of the prim with the lowest link number will be used.

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

Date of Release 10/08/2011

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 );