|
Csteph Submariner
Registered User
Join date: 24 Apr 2007
Posts: 60
|
08-07-2007 16:51
I'm trying to make an object rotate back and forth between two points. I've been using llTargetOmega() to apply the rotation, and I can get it to change directions by changing the sign of the spin rate, but I can't for the life of me work out how to test the current rotation so that the direction changes at a given rotation.
Am I even on the right track?
tia
|
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
08-07-2007 17:43
I think the target omega commands initiate client-side rendering of rotation which is in no way syncrhonized between users. That makes in inherently impossible to test the current rotation when it is done by those commands. The upside is the rotation is smooth and consistent in a very un-SL-like way.
If you want to generate specific rotations that mean something in-world you should probably check out llRotLookAt(rotation target, float strength, float damping);
Though I don't think there is an event to tell you when its done.. anyways, I haven't messed with it much so others probably have more insight.
|
|
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
|
08-07-2007 18:11
I made a see-saw a long time ago that uses targetomega and works just fine. I don't have the script in front of me and forget exactly how I did it... but I believe it was a simple timer that started the targetomega in a direction, then when the timer hit... it sets the end_rot using llSetRot() which is still smooth long with target omega. Then, it does the same thing in reverse. It stays in sync fairly well, but should someone click and screw with it... it gets reset on each end by the llSetRot()... so no big deal.
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
08-07-2007 20:41
From: Shadow Subagja ...If you want to generate specific rotations that mean something in-world you should probably check out llRotLookAt(rotation target, float strength, float damping);
Though I don't think there is an event to tell you when its done... Perhaps superstiously, I too would probably try llRotLookAt. Not sure it's required for this, but an at_rot_target() event can be generated by setting llRotTarget. Don't think I've ever tried that with llTargetOmega; somehow I'd expect it to work if the object were physical (for which the rotation is performed server-side), and otherwise not, but that's just a hunch.
|
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
08-08-2007 08:29
wow I didn't know there was an at_rot_target event, I must have missed that on the wiki
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
Just a thought...
08-08-2007 10:03
From: Csteph Submariner but I can't for the life of me work out how to test the current rotation so that the direction changes at a given rotation.
tia Does the value of llGetRot() even change as the object turns? If not, then what the others said about client-side only are correct. If llGetRot() does change, then maybe your problem is that you are testing for exact equals. Instead, test to see if the two rotations are almost equal...maybe something like rotation r1, r2; if ( llAngleBetween(r1,r2) < 1.0 ) ... Testing if (r1 == r2) is likely to fail because they are different in the nth decimal point on one component.
|