Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

lllSitTarget relative rotation

Fillo Farber
Registered User
Join date: 6 Jun 2004
Posts: 60
09-23-2009 18:25
I would like to set a prim so that no mater what the rotation of the prim on the x axis (i.e. up to 45 deg), when an AV sits on it they are upright - not at 45 deg also. I don't need to update this once the AV is seated - rotations will not change after the AV sits. Is this a case for UpdateSitTarget? The WIKI article on this subject is very confusing. Perhaps I'm looking in the wrong direction...

Agan...
Thanks in advance for the help :)
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
09-24-2009 03:57
The llSitTarget is confusing because it does not work right:)
Read about my confusion and how I was helped in this thread:
/54/09/242119/1.html

The Hero that finally helped me out has his solution here:
/54/6a/153963/1.html

You can copy the scripts from that location or get them in world for free at his shop

Happy scripting:)
_____________________
From Studio Dora
Fillo Farber
Registered User
Join date: 6 Jun 2004
Posts: 60
09-24-2009 08:28
Thanks Dora, that clears up the issue with the bug nicely.

What I'm trying to do still is sit on a target that could be in any random rotation but always have the AV in an upright position. How do you get a sit rotation on a prim that is relative to the region? I'm only concerned with the AV being perpendicular to the ground on the x axis in this case. The prim will not rotate after the AV sits. How do you apply a sit with a rotation relative to the region on an object? (I think that is my question).
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
09-24-2009 08:49
You'll probably have to do this on a timer, and it'll look something like:

CODE

adjustSitTarget(vector relativePos, rotation absoluteRot)
{
rotation relativeRot = absoluteRot/llGetRot();
llSitTarget(relativePos, relativeRot);
}


Not sure whether you also want the avatar to always be facing in the same horizontal direction (e.g. always to the East or whatever), so I didn't show an example of calculating 'absoluteRot'.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
09-24-2009 09:32
From: Fillo Farber
What I'm trying to do still is sit on a target that could be in any random rotation but always have the AV in an upright position. How do you get a sit rotation on a prim that is relative to the region? I'm only concerned with the AV being perpendicular to the ground on the x axis in this case. The prim will not rotate after the AV sits. How do you apply a sit with a rotation relative to the region on an object? (I think that is my question).
Now I understand your question:)
Cut from a simple tele porter script:
CODE

rotation my_rot=llGetRot();
llSitTarget((target - llGetPos()) / my_rot , ZERO_ROTATION / my_rot);
Doing this your AV will always sit upright no matter how your TP prim is rotated.
target is the sit position in global coordinates, so "target - llGetPos()" is the relative "not rotated" sit position.
_____________________
From Studio Dora