Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Using llTargetOmega

Thorne Kaiser
Nice Guy
Join date: 29 Nov 2005
Posts: 132
02-19-2006 20:36
If I use the following to start a prim rotating:
CODE
llTargetOmega(<0,0,1>,PI / 10,1.0); 


and then use the following to stop a prim from rotating:
CODE
llTargetOmega(<0,0,1>,0,0);


It stops and returns to the original rotation. How can I get it to stop at the current rotation instead of snapping back to 0 degrees?

Thanks!
Thorne
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
02-19-2006 20:46
One possibility is to make it physical. If you don't want that, you can do something like in this script, or you can use llRotLookAt.
Thorne Kaiser
Nice Guy
Join date: 29 Nov 2005
Posts: 132
02-19-2006 22:12
Is there also a way to:

1. Get the current rotation
2. Then put it into the llTargetOmega(<0,0,1>,0,0); ?
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
02-20-2006 02:40
From: Thorne Kaiser
Is there also a way to:

1. Get the current rotation
2. Then put it into the llTargetOmega(<0,0,1>,0,0); ?
1. A variant of the script linked to by Zepp could do that, but with normal, non-physical llTargetOmega - no; script cannot read the current rotation because it is potentially different on every resident's client!
2. If you could, then you would probably plug it into llSetRot rather than llTargetOmega.
Thorne Kaiser
Nice Guy
Join date: 29 Nov 2005
Posts: 132
02-20-2006 07:21
OK, I get it now. I tried it and have it working. Thanks for yor responses. I really appreciate your help!!

Thorne
Gearsawe Stonecutter
Over there
Join date: 14 Sep 2005
Posts: 614
02-20-2006 07:52
Another solution which I have found to work quite well is... While the object is rotating you set the end rotation by SetRot. It will continue roating because TargetOmega is a client side animation and overides any SetRots. Since you know the rotation rate you can calculate the where it will be when you call a stop to the the TargetOmega.
I have used this for many things now swings, doors, and drawbridges. The other plus side is the is much less laggy then making an object physical. One set position and a call to stop the rotation. Don't have have use a bunch of SetPosition. It creates a nice smooth rotation without the physical side effect. Another plus is you can have a single object in a link set rotate smoothly as well. The timing is a bit tricky you have to plan in delays casued by the set rotations and by souds if you have any.