Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How do I rotate a prim 360 degrees?

Katoomi Yoshikawa
Registered User
Join date: 17 May 2007
Posts: 22
04-11-2008 07:16
Hello :) I need a rotation script that will make a prim spin around on a single axis once and end up in exactly the same position as when it sarted.

A simple script that will make a prim rotate through 360 degrees :) ...it can't be that hard... can it??

(The prim will be worn as an attachement, and needs to stay in position relative to the attachment, not the world... it will also not be only one prim.. but a few linked together)

Any help will be greatly appreciated.. this is driving me nuts!!! Thank you! :)

^^ KAT
(IM Katoomi Yoshikawa)
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
04-11-2008 09:52
You want to use llTargetOmega to make the object rotate at your desired rate (expressed in radians-per-second) and start a timer to fire off in the period of one rotation. Inside the timer event handler, call llTargetOmega again to stop rotation, and llSetRot to return it to it's initial rotation (since there is invariably a tiny amount of lag which needs to be accounted for).




Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-11-2008 14:12
target omega may not be the best solution since it client side each person may see a different result depending on viewer lag, and if they came into view while it was rotating...

it could probably be cured by splitting it up into 2 calls to half rotations, with a set rot call after each... (2 calls because a set rot call that is < 6 degrees may not update in the viewer, and a single cal would be to the position it's in or 0 degrees which may not update a borked view of target omega... but you can test yourself)

or you could just use set rot and loop through it until you come full circle with
CODE

gRotSixDegrees = llEuler2Rot( <0.0, 0.0, 6.0> * DEG_TO_RAD );//-- or something like that
for (i = 0; i < 60; ++i){
llSetRot( gRotSixDegrees * llGetRot() );
}
_____________________
|
| . "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...
| -
Katoomi Yoshikawa
Registered User
Join date: 17 May 2007
Posts: 22
04-11-2008 15:49
Hi, thanks for the suggestions... I've tried these ideas, but i need a smooth rotation, and the 360 rotation has to be pretty quick. I'm using it to make skateboard tricks. so far, it's either too slow or everything i try has steps to it. I've now asked a custom scripter in game to work on it for me... but thanks for your help! :)