Difference between revisions of "LlLinkSitTarget"

From Second Life Wiki
Jump to navigation Jump to search
m
m (Grammar fix, found another obsolete <source> deep hidden)
 
(15 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|inject-2={{LSL Function/link|link|}}
|inject-2={{LSL_Function/link|link|nogroup=*}}{{LSL Function/offset}}
|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_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.
|func_footnote=If '''offset''' == [[ZERO_VECTOR|{{LSL VR|0.0|0.0|0.0}}]] then the sit target is removed.
|func_footnote=If {{LSLP|offset}} == [[ZERO_VECTOR|{{LSL VR|0.0|0.0|0.0}}]] then the sit target is removed.
|func_desc=Set the sit location for the linked prim(s). The sit location is relative to the prim's position and rotation.
|func_desc=Set the sit location for the linked prim(s). The sit location is relative to the prim's position and rotation.
|return_text
|return_text
|spec=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'''{{Footnote|It is widely considered that the '''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 '''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=*Once a sit target is removed [[llAvatarOnLinkSitTarget]] will only return {{LSL_Constant/NULL_KEY}}.
|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}}.
*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:  
<lsl>llLinkSitTarget(linkNum, ZERO_VECTOR, ZERO_ROTATION);</lsl>
:<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 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).
*'''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]].
*{{LSLP|rot}} affects the position of the sit-target in a buggy way. To correct for the ''rot'' bug, subtract {{LSL VR|0.0|0.0|0.4}} from the position when ''rot'' is 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 than 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]].
**[[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.
**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.
* '''offset''' is limited to 300.0 meters on each axis. The x, y and 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.
|constants
* 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 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
|examples
|helpers
|helpers
Line 30: Line 33:
{{LSL DefineRow||[[llSitTarget]]|}}
{{LSL DefineRow||[[llSitTarget]]|}}
{{LSL DefineRow||[[llSetSitText]]|}}
{{LSL DefineRow||[[llSetSitText]]|}}
{{LSL DefineRow||[[llAvatarOnSitTarget]]|}}
{{LSL DefineRow||[[llAvatarOnLinkSitTarget]]|}}
{{LSL DefineRow||[[llAvatarOnLinkSitTarget]]|}}
{{LSL DefineRow||[[llUnSit]]|}}
{{LSL DefineRow||[[llUnSit]]|}}
Line 35: Line 39:
|also_articles
|also_articles
|notes
|notes
|history=*Scheduled for [[Beta/Magnum|RC Magnum]] channel, week of August 3, 2011.
|history = Date of Release  [[ Release_Notes/Second_Life_Server/11#11.08.10.238207 | 10/08/2011 ]]
|cat1=Sit
|cat1=Sit
|cat2=Vehicle
|cat2=Vehicle
|cat3=Prim
|cat3=Prim
|cat4=Effects
|cat4=Effects
|cat5=Teleport
|cat5=Sit/Teleport
|cat6=Stop
|cat6=Stop
|cat7=Link/Set
|cat7=Link/Set
}}
}}

Latest revision as of 18:21, 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 than just this offset (opensim and SL remain incompatible). You can find the gory details and an example here.
    • 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 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 );