Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llSitTarget does not work as expected

Eadoin Welles
Registered User
Join date: 5 Jan 2007
Posts: 149
04-23-2008 13:35
I am experiencing a strange behaviour. Just consider the following piece of code:

From: someone

string gsCurAnim ;
vector gsCurOffset ;
list glAnimations ; // Read from a notecard
list glOffset ; // Read from a notecard
...
showAnim(integer index)
{
gsCurAnim = llList2String(glAnimations,0) ;
gvCurOffset = (vector)llList2String(glOffsets,0) ;
llSitTarget(gvCurOffset,ZERO_ROTATION) ;
llStartAnimation(gsCurAnim) ;
}


Practically this piece of code execute an animation from a list with a specified offset position, one for each animation.

When I execute showAnim(n), where n is a number, the animation is started as expected, BUT NOT at the specified offset. The code ALWAYS use the initial offset. Any idea why?
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
04-23-2008 13:45
I don't think you can change the sit target once somebody is already sitting there.. I think you need to find which link id the sitting avatar is then use llSetLinkPrimitiveParams to move them.

edit: see the code example at http://wiki.secondlife.com/wiki/LlSitTarget
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
04-23-2008 13:59
llSitTaget() has a reputation and not for the good. It has to be corrected if you want to sit in a specific place.
See: /54/09/242119/1.html
Take special notice of Lex Neva, he provides the solution.
_____________________
From Studio Dora
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
04-24-2008 01:06
When the sit target is updated while someone is already sitting on the prim then that person will NOT move to the new target position. Though if they stand up and sit down again they will.

As mentioned before, you will need to use llSetLinkPrimitiveParams to move the avatar to the new offset position. Unless there are more than one person sitting on a prim or linkset, you can safely assume that the avatar is the last "prim" in the linkset.
Eadoin Welles
Registered User
Join date: 5 Jan 2007
Posts: 149
04-24-2008 02:50
From: Meade Paravane
I don't think you can change the sit target once somebody is already sitting there.. I think you need to find which link id the sitting avatar is then use llSetLinkPrimitiveParams to move them.

edit: see the code example at http://wiki.secondlife.com/wiki/LlSitTarget


OK, I solved it by using llSetLinkPrimitiveParam, but it is a workaround, since you have to move the sit! It looks like there is no way to move the avatar with respect the sit. So I have to create an invisible cover of sit which is the real sit containing the script, record its position, move it from sit to move the avatar, and restore to the original position when avatar unsit! Cumbersome!
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
04-24-2008 03:52
You can use the UpdateSitTarget function found on: https://wiki.secondlife.com/wiki/LlSitTarget

It will update the sit-target while the user is sitting on it (it automatically finds the seated avatar and adjusts their position and rotation (assuming LL didn't bork llSetLinkPrimitiveParams again)). It accounts for the weird difference between sit targets and link positions.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
04-24-2008 10:36
Note that calling llSitTarget() while an avatar is sitting may allow a second avatar to sit on the object at the same time, and they will sit at the new sit target location. To take advantage of this, the new sit target cannot be too close to an already sitting avatar (I believe the test might be that if the sitters' bounding boxes overlapped, the new sitter doesn't have room and cannot sit).

So in a sense not moving the sitter can be considered a feature.