Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Arrgh!

Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
08-07-2007 21:59
I'm still having issues getting an object to rotate around an arbitrary point. What I'm trying to do is to get a plane shaped child prim to rotate round a cylindrical shaped prim. I tried what's in the wiki on arbitrary rotation, but it's not working. What am I missing here?
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
08-07-2007 22:19
good thing i have a mind reading hat, that way i can just magically see your comprehension on this subject and see how you wrote the function too!

1 sec plz .....

oh CRAP, anyone have some D cell batteries? no?


hmm guess your going to have to give up some more information other than "it doesnt work"
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
08-08-2007 16:39
From: Osgeld Barmy
good thing i have a mind reading hat, that way i can just magically see your comprehension on this subject and see how you wrote the function too!

1 sec plz .....

oh CRAP, anyone have some D cell batteries? no?


hmm guess your going to have to give up some more information other than "it doesnt work"


ok, used it right off the wiki, and it doesnt work...

vector currentPos = llGetPos();
vector rotPoint = llGetPos() + <1, 1, 1>; // in global coordinates
vector newPos = rotPoint + ((currentPos - rotPoint) * x_45);
llSetPos(newPos);

also, what that's supposed to do, from what I'm seeing, is move an object around an arbitrary point, what I want is ROTATION around the arbitrary point. Anyone???

edit: when I tried the above code, nothing happened, the object doesnt budge.
Also, if it makes it any easier, what I'm trying to do is make a book open. The binding will be the root prim, and the cover will be rotating open about the binding. Thanks
Hg Beeks
llGetElement(80);
Join date: 13 Apr 2006
Posts: 134
08-08-2007 16:54
From: Johan Laurasia
ok, used it right off the wiki, and it doesnt work...

vector currentPos = llGetPos();
vector rotPoint = llGetPos() + <1, 1, 1>; // in global coordinates
vector newPos = rotPoint + ((currentPos - rotPoint) * x_45);
llSetPos(newPos);

also, what that's supposed to do, from what I'm seeing, is move an object around an arbitrary point, what I want is ROTATION around the arbitrary point. Anyone???

edit: when I tried the above code, nothing happened, the object doesnt budge.
Also, if it makes it any easier, what I'm trying to do is make a book open. The binding will be the root prim, and the cover will be rotating open about the binding. Thanks

Where do you define x_45?
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
08-08-2007 16:56
From: Hg Beeks
Where do you define x_45?


Sorry, I copied that right out of the wiki, at the top of the code I set X_45... it should look like this

integer X_45 = 45;
vector currentPos = llGetPos();
vector rotPoint = llGetPos() + <1, 1, 1>; // in global coordinates
vector newPos = rotPoint + ((currentPos - rotPoint) * x_45);
llSetPos(newPos);
Hg Beeks
llGetElement(80);
Join date: 13 Apr 2006
Posts: 134
08-08-2007 17:03
x_45 and X_45 are two different things, but I'm assuming they're the same on your script.
What triggers these lines? Is it in the touch? The state_entry? The script you gave still doesn't look like a fully functioning rotation script (Read: No rotation in it), but getting it to work at all is the first step.
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
08-08-2007 17:08
From: Hg Beeks
x_45 and X_45 are two different things, but I'm assuming they're the same on your script.
What triggers these lines? Is it in the touch? The state_entry? The script you gave still doesn't look like a fully functioning rotation script (Read: No rotation in it), but getting it to work at all is the first step.


agreed, first, that was a type... it is correct in the script, I was triggering via a touch start event....

default

{
touch_start (integer num_detected)
{
integer x_45 = 45;
vector currentPos = llGetPos();
vector rotPoint = llGetPos() + <1, 1, 1>; // in global coordinates
vector newPos = rotPoint + ((currentPos - rotPoint) * x_45);
llSetPos(newPos);
}
}

and I agree, this will not do what I want, as there is no rotation of the object, yet I cannot even get THIS to work.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
08-08-2007 19:56
Okay, well, in this wiki example, x_45 is supposed to be a rotation, not a scalar, a la:

rotation x_45 = llEuler2Rot( <45 * DEG_TO_RAD, 0, 0> );

and, when it works, it should move the object about the specified point, although the object itself won't rotate correspondingly; for that, there'd need to be llSetRot() too.

But before chasing down that path further... I think what's desired is much simpler, now that it's clearer what the application is. What I'd do is to offset the axis of rotation of the bookcover such that it's at the edge of the prim, and then just llSetRot() to rotate about that edge. To do that, I usually choose the Z-axis, and offset it by temporarily switching the box to a sphere and then Dimpling it by half; switched back to a box, the Z axis is along one half of the truncated prim. (In this case where the axis is to be at the very edge of the prim--so it's being cut exactly in half--one could use either of the other axes instead by Cutting to .125 and .625, or .375 and .875.)

In any case, the truncated prim can then be just rotated about whichever axis is now at the edge.
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
08-09-2007 01:20
Thanks, Hg IM'd me inworld and showed me the same trick, path cutting to offset the centerpoint, worked great, and thanks for the explanation about the wiki as well :)