|
Emily Barnside
Registered User
Join date: 11 May 2009
Posts: 3
|
05-11-2009 21:39
So i've used this from void singers page: vector vPosOffset = <.0, .0, 1.0>; //-- the point we are rotating around in relation to our object vector vDegArc = <.0, .0, 60.0>; //-- how far around the circle to travel each move rotation vRotArc = llEuler2Rot( vDegArc * DEG_TO_RAD ); rotation vRotTrack; //-- optional, only used in method 2 //-- Method 1: Always keep same face toward the point //-- notice you have to move AND rotate, or else the new //-- position becomes a diagonal line instead of a circle llSetPrimitiveParams( [PRIM_POSITION, llGetPos() + (vPosOffset - vPosOffset * vRotArc) * llGetLocalRot(), PRIM_ROTATION, vRotArc * llGetLocalRot()] );
vRotTrack = vRotArc * vRotTrack;
It works great, but vRotTrack starts at <0.0, 0.0, 0.0> if the script is reset even though the object itself is still rotated. I'm sure there is some way to get where it is on the circle, but in my arsenal of math skills, rotational math is not in there. Any help would be appreciated. Thank you 
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-12-2009 00:12
you have to keep calling the function in a loop, it's only one increment of a full circle rotation.
you also don't need vRotTrack using that method... simply keep using the llSetPrimitiveParams call in a loop as many time as you need it.
I really need to add some update to that page and link it across to the rotations article (currently it's only available through links to my user page, and from a few links scattered on the forums.)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Emily Barnside
Registered User
Join date: 11 May 2009
Posts: 3
|
05-12-2009 09:57
Perhaps I need to be more clear, I do call that in a loop and also vRotTrack is global. What i'm saying is I need to know where it is in its circlular Loop. vRotTrack will tell me where each axis is in the circle BUT if the script should be reset since the object itself is still rotated, vRotTrack is no longer accurate. So to summarize im looking to get a value from either 0-180, -179 - 0 or 0-360, for each axis. Depending on where the object currently is. So for example say the object is now at 80 degrees on its circular path on the x axis. Then the script gets reset. I want to be able to know that the the object is rotated 80 degrees on its circular path on the x axis. I hope this is clear.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-12-2009 10:22
thats simpler (and you still don't need the tracking variable).
assuming you start at zero rotation initially... on reset check llRot2Euler( llGetRot() ) * RAD_TO_DEG; that will tel you your current rotation around your preset offset in x/y/z rotation
if you don't use a zero rotation initial position, you can store your initial position before you start in the description field of the object using llGetObjectDesc() and compare it to what you have on_rez
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Emily Barnside
Registered User
Join date: 11 May 2009
Posts: 3
|
05-12-2009 10:42
Two things. Will that work in a child? Second, I would prefer not to store anything in the description. Will see if this works.
Edit: So using the first half I'll I got was a bunch of duplicates and such. So Assuming im not starting from a zero rotation might you be able to explain what you mean a bit more in the second half of your suggestion? On a side note this seems a bit strange an approach to me. I would think getting the rotation would just tell you the objects rotation. Not its rotation along its circular path around the offset, but will see.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-12-2009 17:09
because that method tracks the rotation by always facing the middle it also tells where in the arc it is because those rotation will match. on the second method in the state_entry (sorry not on_rez) event you'd check the current rotational offset and the prim description (llGetLocalRot and llGetObjectDesc respectively) if there is nothing set in the objects description you assume you are at your starting position, and set the description with llSetObjectDesc. if there IS something set in the description you compare it to your rotation and that will till you were you are on the arc. (you should be able to subtract one from the other to get the number you want) the storage of the rotation outside the script is necessary to survive the script resetting. if you're using this rotation in a child prim you need to make the adjustment that's found in the following Jira article (because LL goofed the implementation): https://jira.secondlife.com/browse/SVC-93
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|