Difference between revisions of "LlLinkSitTarget"

From Second Life Wiki
Jump to navigation Jump to search
(Added a caveat about LINK_ROOT (1) failing for an unlinked prim.)
(Replaced <source> with <syntaxhighlight> and did some WikiSyntax clean-up (with added wikilinks))
Line 11: Line 11:
|return_text
|return_text
|spec=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 {{LSLP|rot}} and the {{LSLP|offset}}{{Footnote|It is widely considered that the {{LSLP|rot}} should not affect the position, unfortunately the sit target code is a {{Wikipedia|Lava_flow_(programming)|lava-flow}}. ~ {{JIRA|SVC-2277}}|It is widely considered that the 'rot' should not affect the position, unfortunately the sit target code is a lava-flow. - SVC-2277|handle=rot-offset}}.
|spec=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 {{LSLP|rot}} and the {{LSLP|offset}}{{Footnote|It is widely considered that the {{LSLP|rot}} should not affect the position, unfortunately the sit target code is a {{Wikipedia|Lava_flow_(programming)|lava-flow}}. ~ {{JIRA|SVC-2277}}|It is widely considered that the 'rot' should not affect the position, unfortunately the sit target code is a lava-flow. - SVC-2277|handle=rot-offset}}.
|caveats=* {{LSLP|link}} needs to be [[LINK_THIS]] for an unlinked prim. Specifying [[LINK_ROOT]] (integer value 1) will not work.
|caveats=* {{LSLP|link}} needs to be [[LINK_THIS]] for an unlinked prim. Specifying [[LINK_ROOT]] ([[integer]] value 1) will not work.
*Once a sit target is removed [[llAvatarOnLinkSitTarget]] will only return {{LSL_Constant/NULL_KEY}}.
*Once a sit target is removed [[llAvatarOnLinkSitTarget]] will only return {{LSL_Constant/NULL_KEY}}.
*Removing or deactivating the script that sets the sit target will not remove the prim's sit target.
*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.  
**Sit target is a prim property and not dependent on a script for its continued existence.  
*To remove sit target, use the following:  
*To remove sit target, use the following:  
<source lang="lsl2">llLinkSitTarget(linkNum, ZERO_VECTOR, ZERO_ROTATION);</source>
:<syntaxhighlight lang="lsl2">llLinkSitTarget(linkNum, ZERO_VECTOR, ZERO_ROTATION);</syntaxhighlight>
*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 "&nbsp;" or similar transparent string.
*There is no way to remove the Sit option from the [[Context Menu|pie menu]]. It will appear to be removed if the [[llSetSitText]] is set to a space "&nbsp;" or similar transparent string.
*Attachments cannot be sat upon (see {{jira|SVC-6100}} to vote for such a feature).
*Attachments cannot be sat upon (see {{jira|SVC-6100}} to vote for such a feature).
*{{LSLP|rot}} affects the position of the sit-target in a buggy way. To correct for the ''rot'' bug, subtract <0, 0, 0.4> from the position when ''rot'' is zero. See example in [[llSitTarget]]. This offset is <0, 0, 0.418> on opensim 0.7.6 (it's 0.4 on version 0.8), but there is more to it then just this offset (opensim and SL remain incompatible). You can find the gory details and an example [[User:Timmy_Foxclaw/About_Coordinate_Systems_and_Rotations|here]].
*{{LSLP|rot}} affects the position of the sit-target in a buggy way. To correct for the {{LSLP|rot}} bug, subtract {{LSL VR|0.0|0.0|0.4}} from the position when {{LSLP|rot}} is [[ZERO_ROTATION|zero]]. See example in [[llSitTarget]]. This offset is {{LSL VR|0.0|0.0|0.418}} on [[OpenSimulator]] 0.7.6 (it's 0.4 on version 0.8), but there is more to it then just this offset (OpenSimulator and SL remain incompatible). You can find the gory details and an example [[User:Timmy_Foxclaw/About_Coordinate_Systems_and_Rotations|here]].
**[[llSetLinkPrimitiveParams]] is a more difficult workaround.
**[[llSetLinkPrimitiveParams]] is a more difficult workaround.
**Animations are relative to the Agent Target, but the Agent Target isn't described by the animation.
**[[Animation|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 [[llSitTarget#UpdateSitTarget|UpdateSitTarget]] for a way to do this.
*[[llSitTarget]] does not update position of an already seated avatar. See [[llSitTarget#UpdateSitTarget|UpdateSitTarget]] for a way to do this.
* {{LSLP|offset}} is limited to 300.0 meters on each axis. The {{LSLP|x}}, {{LSLP|y}} and {{LSLP|z}} components must be in the range {{Interval|lte=300.0|gte=-300}}{{Footnote|handle=interval}}.
* {{LSLP|offset}} is limited to 300.0 meters on each axis. The {{LSLP|x}}, {{LSLP|y}} and {{LSLP|z}} components must be in the range {{Interval|lte=300.0|gte=-300}}{{Footnote|handle=interval}}.
** If they are outside the acceptable range they are rounded to the closest limit.
** 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 ''llLinkSitTarget''s), the following method determines which sit target an avatar ends up at:
* If an object has multiple seats (each seat has a script that sets a sit target with [[llSitTarget]], or the [[link set]] has a script that assigns several [[llLinkSitTarget]]s), 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'' 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.
**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.

Revision as of 17:45, 4 February 2023

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

llLinkSitTarget(linkNum, ZERO_VECTOR, ZERO_ROTATION);
  • 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, subtract <0.0, 0.0, 0.4> from the position when rot is zero. See example in llSitTarget. This offset is <0.0, 0.0, 0.418> on OpenSimulator 0.7.6 (it's 0.4 on version 0.8), but there is more to it then just this offset (OpenSimulator and SL remain incompatible). You can find the gory details and an example here.
  • 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 link set 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 );