What do the sit script variables stand for?
|
|
Cocoanut Koala
Coco's Cottages
Join date: 7 Feb 2005
Posts: 7,903
|
10-27-2005 09:47
I have an item and put a pose ball on it. I have put the sit script into the pose ball, and another script that makes it work. However, I can't get myself to sit where I want to and how I want to. I change the numbers in the script, and notice where it puts me and try to do it all through deduction. But this is a terrible way to go about it! I need to know what these numbers stand for. There are two sets of three variables each on this sit script. Not looking at it now, I hope I can explain this well enough. First set has 0, 0, 0. Second set (I think that is called "rot"  also has 0, 0, 0. That is, it has those places (they don't necessarily say 0 right now). Now, I have it in my head that the first set has to do with where you are sitting. The second set has to do with the rotation of where you are sitting. However, messing with these numbers randomly trying to figure out exactly how they work is terrible, trying to figure out what they stand for simply by manipulating them. And the combinations of 3 and 3 variables is just a whole LOT to sit there messing with them in perpetuity (especially considering they can each be minus as well as positive), trying to accidentally hit on the combination that gives me the exact sit position I want. So, could someone explain what these variables stand for for me? In other words: 0 - what does this do? And how do the positives and negatives affect it? For each of them. Example: "< 0,0,0> The first zero stands for where you are sitting in terms of the x axis. If you go negative, it will take you negatively along that axis. This goes up to say, 2, assuming you dont want to be sitting in the next sim." I made that up! I'm guessing! Could someone really explain each of these six zeros to me in that fashion? If I KNEW what these things stood for, I betcha I could manipulate them well enough to get myself to sit on the furniture I'm making WHERE I want to sit on it. This just changing a number and trying to figure out why it did what it did is wasting hours and hours. I know I can highlight transparent and just manipulate the pose ball while I'm sitting on it. But I want to be able to do the numbers because I want to sit to the right of and below where the actual pose ball will be. Thanks, coco
|
|
Michael Martinez
Don't poke me!
Join date: 28 Jul 2004
Posts: 515
|
10-27-2005 10:14
llSitTarget (<0,0,0>, ZERO_ROTATION);
the first 0 is forward/back (X) (negative would be back, positive forward) the second 0 is left/right (Y) (negative would be left, positive right) the third 0 is up/down (Z) (negative would be down, positive up)
The ZERO_ROTATION is what angle the person sits at...
If all the values are 0, as above, it will cancel any sit postion and just be about where the person click to sit..
Thats is all..
|
|
Newfie Pendragon
Crusty and proud of it
Join date: 19 Dec 2003
Posts: 1,025
|
10-27-2005 10:15
Might be helpful to provide the name of the poseball script or the creator of it. There's dozens of varieties of poseballs in SL, all made by different folks, and likely all using different settings.
-Newfie
|
|
cua Curie
secondlifes.com/*****
Join date: 14 Nov 2003
Posts: 196
|
10-27-2005 10:18
This is a sit target function: llSitTarget(<0,0,0>,<0,0,0,1> ; (btw this sit target won't actually work, as using a zero setting removes any current sit target. you must move the target at least a minimal amount away from the center of the prim or rotate a bit in order to use the function.) This is how it breaks down: llSitTarget(offset distance from the center of the prim,rotation );
llSitTarget(<x axis, y axis, z axis>,<0,0,0,1> ;<0,0,0,1> is the rotation. <0,0,01> can also be called as ZERO_ROTATION. It in a format called a quaternion. It does not stand for x y and z axis. you can however convert a x,y,x rotation like you see in the edit object dialog by using a conversion function like.. rotation rot=llEuler2Rot(<0,0,90>*DEG_TO_RAD);(DEG_TO_RAD is a built in variable that you use to convert degrees to radians.) So lets take an example. Say you want to have the sit target be 1 meter above the prim, and rotated 45 degrees on the x axis. This is what you would do. rotation rot =llEuler2Rot(<45,0,0>*DEG_TO_RAD); llSitTarget(<0,0,1>,rot);Rotations can be a very confusing issue even for experienced scripters. Here is a link to the wiki page that tries to explain it. http://secondlife.com/badgeo/wakka.php?wakka=rotation
_____________________
"It is better to keep your mouth shut and appear stupid than to open it and remove all doubt." - Mark Twain
"We are what we pretend to be, so we must be careful what we pretend to be." - Kurt Vonnegut
|
|
Aliasi Stonebender
Return of Catbread
Join date: 30 Jan 2005
Posts: 1,858
|
10-27-2005 10:19
From: Cocoanut Koala I have an item and put a pose ball on it. I have put the sit script into the pose ball, and another script that makes it work.
Well, I don't know how your sit script may be formatted but I can tell you how the function that does this bit, llSitTarget, works. llSitTarget takes two parameters, an offset, shown as a vector (<x, y, z>  and a rotation (which looks a lot like a vector, but with four numbers. <a, b, c, d>. This is because rotations are stored as this mathmatical construct known as a quaterion, which you probably don't want to get into). The offset is easy enough; it sets where you'll be sitting, relative to the local axes and center of the prim. (Note, that's of the *prim*, not the object in a linked set of prims.) The rotation is a bit trickier. LSL expects all angles in terms of radians, not degrees... whereas the actual edit box uses degrees. But... you can convert one to another by multiplying by the special DEG_TO_RAD constant. But then, you still have a vector, not a quaterion! That's what the function llEuler2Rot is for; a rotation based on the X, Y, and Z axes is known as a "Euler rotation", and that function converts it to the quaternion llSitTarget prefers. "But Aliasi!" you say. "That's all scripting mumbo-jumbo, just tell me what to do!" Well... problem is, I don't know what your sit-script looks like. If both numbers are units of 3 (like <0, 0, 0>  then they're converting the Euler to a proper quaternion rotation, but without looking I couldn't tell you if you should use degrees or radians; they may have skipped that conversion. If you could drop it on me in-world sometime I can tell you what to do and set it so you can just use degrees, which are more intuitive for the non-mathematician/scripter. 
_____________________
Red Mary says, softly, “How a man grows aggressive when his enemy displays propriety. He thinks: I will use this good behavior to enforce my advantage over her. Is it any wonder people hold good behavior in such disregard?” Anything Surplus Home to the "Nuke the Crap Out of..." series of games and other stuff
|
|
sazzysaphire Bijoux
Registered User
Join date: 22 Dec 2004
Posts: 11
|
pose ball script
10-27-2005 10:21
agggg, sometimes the best recourse is to just sit on the ball, go to view highlight transparent, and then move the ball. you can usually place the ball close enough to anything you want to sit on that you can still see it and still link it to the item, or another ball. if the ball is linked, you have to hop off / unlink / hop on. there is a lot of ho ho going on when aligning balls (hop off/hop on) find someone willing to be a pose dummy and have fun with it. some very boring pose balls take on a new aspect when you turn them topsy turvy. sitting upside down on the roof for instance. i'm no expert, but i have limited experience and would be happy to help if i can.
|
|
Gaz Hornpipe
Registered User
Join date: 29 Sep 2005
Posts: 36
|
10-27-2005 12:59
The most important thing to remember with llSitTarget() is that the position and rotation are "offsets" based on the current position and rotation of the prim that the script is in. So if the prim is at position 100,100,100 and you have the sittarget position at <1,-1,1>, the actual avatar will sit at (based on the centre of the avatar) 101,99,101 in the sim. While the prim stays at 100,100,100. Only the avatar sits at the offset. And it is the same with the rotation. If the prim's rotation is set to 0,0,0 and you have the sittarget rotation set to (in degrees) 0,90,0.. then the avatar will be rotated 90 degrees on the Y-axis. The important things to remember with rotations is that they are done in radians so if you want to use degrees, you will need to use a function like llEuler2Rot() and also that the rotation is applied in a specific order. It doesn't just go: apply 0,90,0. It goes: apply 0 then apply 90 then apply 0. Which basically means, if you change the rotation of one axis, then try to change the rotation of another axis (even in the same set rotation call) the ordering of the rotation forces all rotation parameters to be offsets of the previous rotation. So 90,90,0 is not the same as typing 90,90,0 into the edit window. You will notice if you do type it into the edit window.. the edit window will automatically update to compensate for what you intended. So, just as an example, it might change the value in the edit window to 0,180,270 because after applying the first rotation of 90 degrees on the x-axis.. a rotation of a further 90 degrees to the y-axis is completely different than if you hadn't rotated the x-axis in the first place. Yes.. even if you go llSitTarget(<0,0,1>,llEuler2Rot(<90 * DEG_TO_RAD, 90 * DEG_TO_RAD,0>  ); it does the same annoying thing. In the end, it is best to keep the sittarget rotation at ZERO_ROTATION (ie. <0,0,0,1>  and rotate the prim with the edit window, while the avatar is sitting on it.
|
|
Cocoanut Koala
Coco's Cottages
Join date: 7 Feb 2005
Posts: 7,903
|
10-27-2005 16:24
Thanks, guys! When I go in game, I will see what the name of that script is, but I think it is just, "Sit script." Then I will also print out this whole thread and study it. coco
|