Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llSetPos + llSitTarget + Child Prims

FireEyes Fauna
Registered User
Join date: 26 Apr 2004
Posts: 138
10-29-2005 04:38
Here's a problem I've been having for awhile, not sure if it's a bug so I'll ask here :)

Put the following code inside a prim...

CODE

default
{
state_entry()
{
llSitTarget(<0,0,1>,ZERO_ROTATION);
}
touch_start(integer num_detected)
{
llSetPos(llGetPos() + <0,0,5>);
}
}


When you sit on the prim, then touch it, the prim and avatar move up 5 meters. Now make another prim and add the similar code (But adjusted for Child Prim status)...

CODE

default
{
state_entry()
{
llSitTarget(<0,0,1>,ZERO_ROTATION);
}
touch_start(integer num_detected)
{
llSetPos(llLocalGetPos() + <0,0,5>);
}
}


or

CODE

default
{
state_entry()
{
llSitTarget(<0,0,1>,ZERO_ROTATION);
}
touch_start(integer num_detected)
{
llSetPos(<0,0,5>);
}
}


I know the effect of the two scripts isn't the same, but was just troubleshooting to see if llGetLocalPos() was the problem. Anyways, link the two prims together with the original as the parent.

Sitting on the Parent object still produces the desired results, prim and avatar moving up 5 meters. The child prim also moves up 5 meters now.

Now sit on the child prim. When you touch the Parent object, the desired results happen. The parent prim, child prim (and agent on child prim) both move up 5 meters.

When you touch the Child object however, just the Prim will move up 5 meters. The agent stays floating in the air.

The only cause for this than I can think of is the llSitTarget behaving incorrectly. When used in a child prim, I think it must take on the form of llSitTarget(llGetLocalPos() + OFFSET) and be calculated based on the Parent Prim.

Bug?

Thanks,

FireEyes Fauna
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
10-29-2005 07:27
I have seen this behaviour and agree that it is inconsistent. I have not been able to determine a workaround for it.

A bit of detail on the observed behaviour...

If you have a child prim that has a sit target set, and then move that child prim relative to the root prim while the avatar is seated, nothing seems to happen. But if the avatar then stands and resits, they will sit in the new position according to the child prim's updated relative position to the root prim... it's highly annoying and restrictive behaviour. I cannot really see a reason why it should work this way from a functional perspective.

There are no doubt 1000 technical arguments for why it works this way... but like any functional bug, the technical arguments are just noise.

*edit - To OP, I assume you understand that calling setpos in a child prim moves that prim only? There is no llSetLocalPos... - end edit*
_____________________
http://slurl.com/secondlife/Together
FireEyes Fauna
Registered User
Join date: 26 Apr 2004
Posts: 138
10-29-2005 09:08
*Reply to edit*

The 2 different scripts I posted for the child prim were because the first one would move the child prim 5 meters up from it's current offset of the parent (Yeah, should have been llGetLocalPos()..) and the 2nd script would just move it 5 meters above the position of the parent.
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
10-29-2005 10:12
*reply to edit reply*
Um there is an llGetLocalPos, but if you use llSetPos in the child it affects only the child.
_____________________
http://slurl.com/secondlife/Together
Alexander Yeats
Registered User
Join date: 8 Sep 2005
Posts: 188
10-29-2005 12:19
Just thinking here...


If the desired behavior works correctly on the child prim, maybe you could hide the root prim inside one of the children? so the av never touches the root?

Or just remove touching from the root?

Obviously not sure what you are doing, but FWIW....
_____________________
FireEyes Fauna
Registered User
Join date: 26 Apr 2004
Posts: 138
10-29-2005 17:50
What I tried using this for was the Syncronization Balls that are inside the shelter. It drops down 8 balls and when the avatar sits on them, it moves up x meters according to the avatar height. This way all the dancers are the same height.

I ended up having to llRezObject the balls and it works fine. Would just be so much easier of they could be children of the parent object :)
Per Skookum
Registered User
Join date: 24 Jan 2007
Posts: 4
Bug report filed
03-23-2007 03:28
From: Escort DeFarge
If you have a child prim that has a sit target set, and then move that child prim relative to the root prim while the avatar is seated, nothing seems to happen. But if the avatar then stands and resits, they will sit in the new position according to the child prim's updated relative position to the root prim... it's highly annoying and restrictive behaviour. I cannot really see a reason why it should work this way from a functional perspective.


The same behaviour has been observed in a script i'm writing now... putting it simply the child prim won't move until the avatar stands up. At that point the prim moves to the new position.

I've filed a bug report on this one at https://jira.secondlife.com/browse/MISC-53 so please vote for the bug to be fixed!
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
03-23-2007 14:11
When an avatar sits on a child prim of an object the sim uses the child prim's position, orientation, and sit target to figure out where to put the avatar. But then the avatar becomes another child prim of the object and no longer has a geometric relationship with the prim that it sat upon. They are peers now, except that scripts in the prim can get various permissions for the avatar. Changing the child prim position, orientation or sit target only has an effect the next time that an avatar sits on that prim. Moving the root prim moves all of the child prims, including sitting avatars.

Has any tried to change the position or orientation of a sitting avatar using llSetLinkPrimitiveParams? They have a link number just like a prim. I'll try that later tonight and report back here.
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
03-23-2007 23:01
Yahoo! It works!

You can change the position and orientation of a seated avatar using llSetLinkPrimitiveParams! If you specify the link number corresponding to the avatar you can move him/her around. Doing this does not change the sit target used the next time an avatar sits on the prim.