Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sitting on torus prim

MikeR Bardach
Registered User
Join date: 22 May 2008
Posts: 9
05-27-2008 07:00
I made a pillow, basically built out of a torus and a few other small prims. I was able to sit on it fine. But I wanted to add a script to do something when you sit on it, and so I needed to add llSitTarget(<0.01,0,0>,ZERO_ROTATION) in the script. As soon as I did that, when I sit on it I end up sitting horizontally, that is, as if I am sitting on a chair on a wall. (I guess the reason is that the torus has the z-axis horizontally?) What can I do so that I can sit on the pillow normally? Thanks.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
05-27-2008 07:22
This really should be in Scripting Tips, not Building Tips. But in any case, the answer is you simply change the rotation setting in the llSitTarget script. Instead of "ZERO_ROTATION" or "<0,0,0>", you'd want something like "<0,0,90>" or "<90,90,0>" or so. Which axis or axes to change will depend on how you have the prim rotated, and on which direction you want the avatar oriented relative to it.

If you're not clear on how the math works, just experiment. Change one axis to 90, sit on the prim, and see which way the avatar is facing. If it's not right, stand up, change the rotation to a different axis, and sit down again. There are only a handful of possible combinations of 0's and 90's, so it won't take much time to find the right one.

For more information, see http://wiki.secondlife.com/wiki/LlSitTarget
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Imnotgoing Sideways
Can't outlaw cute! =^-^=
Join date: 17 Nov 2007
Posts: 4,694
05-27-2008 07:47
Try to find the "sit target helper" tools. I got mine free from a friend. It gives you a script to put in your root prim or pose ball and a temporary sittable prim that you put your sit animation in and adjust to where you want to be. (^_^)

With that, it's just a matter putting the ani in the reference prim, the script on your seat, sitting on the reference and positioning yourself, then finally clicking the scripted seat. The llSitTarget line will be whispered out to chat. Move your animation to the seat prim, delete the reference prim, and set the sit target script with the line from chat. Instant perfect sit position with or without poseballs. (^_^)

I used the tool on the chair and bench I keep in my cookie jar. They sit a little deep for non-loli avatars, but, still really good... I tried them in a few avatar sizes. (^_^)y
_____________________
Somewhere in this world; there is someone having some good clean fun doing the one thing you hate the most. (^_^)y


http://slurl.com/secondlife/Ferguson/54/237/94
MikeR Bardach
Registered User
Join date: 22 May 2008
Posts: 9
05-27-2008 08:43
Thanks very much, you-all. I had been unsure whether it should go in Scripting Help or Building Help, but you were a lot of help!

By the way, Chosen Few, the reason I hadn't understood till you explained, is that I thought Rotation in the llSitTarget specs was some kind of dynamic thing, that the sitting object would be rotating around. Thanks for clarifying.
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
05-27-2008 18:12
Chosen has the right idea here, but probably forgot for a moment that rotations don't use vectors (like 3D coordinates) - they use quaternions, which describe the same thing with a set of 4 numbers (not 3) and are almost impossible to tweak by hand since the math is so unintuitive and, well, just weird.

Fortunately there are some built-in functions to do the conversions for us. Try something like this:
CODE


vector eul = <90,0,0>; //90 degrees around the x-axis, in Euler form
eul *= DEG_TO_RAD; //convert to radians
rotation quat = llEuler2Rot(eul); //convert to quaternion
llSitTarget(<0.01,0,0>, quat); //set the sit target with the quaternion


Leave out the
CODE
 stuff at the beginning and end if you see it, that's just forum formatting doodads.

That one you can tweak by hand in the first line by sticking a 90 in there, although I may have picked the wrong number to change - so like Chosen suggests try <0,90,0> or <0,0,90> if you just end up tipped sideways in some strange new way.


Also Imnotgoing is right, there are some great free tools to help you line up poses if you don't want to do it manually. I believe most are based on the script here:

http://forums.secondlife.com/showthread.php?t=153963

and I'm pretty sure someone "sells" one in a prim ready to go for $0 on SL Exchange if that's handier.

Hope some of this helps :)
_____________________
Designer of sensual, tasteful couple's animations - for residents who take their leisure time seriously. ;)

http://slurl.com/secondlife/Brownlee/203/110/109/