Need Help with Simple Rotation
|
|
Charity Aker
Registered User
Join date: 6 May 2008
Posts: 10
|
12-01-2008 08:51
Ok I know this must be out there somewhere and I am no script writer so thought I would ask for some help.
I make clothing and would like to display my prim flexi skirts in my store. I would like to be able to put a script in the root prim to make the skirt rotate to the left 90 degrees and than rotate back to original, rotate than 90 degrees to the right and than back to the original, than perhaps pause for 10 seconds and repeat.
This is to show off the movement of the flexi prim skirt or attachment.
Any help would be greatly appreciated.
Thanks so Much Charity
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
Rough outline...
12-01-2008 09:52
Off top of head, no doubt full of syntax errors... // yeah, like that will ever work
rotation rot;
default { state_enter() { rot = llGetRot(); llSetTimerEvent(10); //every ten seconds }
timer() { vector newrot = llRot2Euler(rot); newrot.z += 90*DEG_TO_RAD; // 90 to the left llSetRot( llEuler2Rot( newrot ); llSleep(1); // pause 1 second llSetRot( rot ); // rotate back } }
[\PHP]
Put this in a cylinder. Put the skirt on the cylinder like a mannequin. Either make the cylinder invisible, or decorate it somehow. If you have a real mannequin, you could prolly use that.
_____________________
So many monkeys, so little Shakespeare.
|
|
Scott Savira
Not Scott Saliva
Join date: 10 Aug 2008
Posts: 357
|
12-01-2008 10:00
I think it'd be better to do it via llTargetOmega. Less lag and a lot smoother animation.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
12-01-2008 10:10
llLootAt() or llRotLookAt() could also work. They would give you roughly the same kind of control llTargetOmega() would for the speed of rotation and also let you control the start and end positions instead of guessing and having it be different on each viewer.
|
|
Scott Savira
Not Scott Saliva
Join date: 10 Aug 2008
Posts: 357
|
12-01-2008 10:17
I normally stick an llSetRot after the llTargetOmega to correct any problems with the rotation being slightly beyond it's intended spot. Sans bad lag, it usually displays the rotation quite accurately. I haven't tried llLookAt or llRotLookAt yet. Are there any pros and cons between the two solutions?
|
|
Charity Aker
Registered User
Join date: 6 May 2008
Posts: 10
|
12-01-2008 10:29
Yes a syntax error , I would be happy to pay someone to make a script for this. and I have a manaquin top to link to the skirt that can be the root prim.
Thanks Again Charity
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
12-01-2008 10:40
From: Lee Ponzu Off top of head, no doubt full of syntax errors... rotation rot;
default { state_entry() { rot = llGetRot(); llSetTimerEvent(10); //every ten seconds }
timer() { vector newrot = llRot2Euler(rot); newrot.z += 90*DEG_TO_RAD; // 90 to the left llSetRot( llEuler2Rot( newrot )); llSleep(1); // pause 1 second llSetRot( rot ); // rotate back } } [\PHP] The problem was that you didn't put the open {'s on their own line. There were also a couple typos that I fixed. The above should compile now.
Make sure that the cylinder that Lee suggested linking in is the root prim..
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Charity Aker
Registered User
Join date: 6 May 2008
Posts: 10
|
still get a error
12-01-2008 10:50
rot = llGetRot();
this line I get this error
name not defined within scope
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
12-01-2008 10:52
Make sure you have this at the very top of the script: rotation rot; It's in my post above but it's on the same line as the ever-so-useful tag..
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Charity Aker
Registered User
Join date: 6 May 2008
Posts: 10
|
I got it
12-01-2008 10:54
thank you thank you
you all ROCK
|
|
Charity Aker
Registered User
Join date: 6 May 2008
Posts: 10
|
ok so now I have my skirt going to the left
12-01-2008 11:14
So how would I change this script to make it go left first than back to center than to the right and back to center? pause 10 seconds and repeat.
Thanks Charity
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
12-01-2008 11:30
Maybe something like this would work... float direction = 1; rotation rot;
default { state_entry() { rot = llGetRot(); llSetTimerEvent(10.0); //every ten seconds }
timer() { vector newrot = llRot2Euler(rot); newrot.z += direction * 90.0 * DEG_TO_RAD; llSetRot( llEuler2Rot( newrot )); llSleep(1.0); // pause 1 second llSetRot( rot ); // rotate back
direction *= -1; } } [\PHP]
edit: if hit the Quote button, the formatting will reappear. Good trick to do when you're copying/pasting scripts from the forums.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Charity Aker
Registered User
Join date: 6 May 2008
Posts: 10
|
yeah,,, works
12-01-2008 11:38
Thank you all so much for your help, that last worked for both directions.
Again Thank you all for the help
Charity
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
12-01-2008 11:48
/me does the happy dance.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
12-01-2008 11:50
From: Charity Aker So how would I change this script to make it go left first than back to center than to the right and back to center? pause 10 seconds and repeat.
Thanks Charity This is called "changing the requirements" and is not allowed.
_____________________
So many monkeys, so little Shakespeare.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
12-01-2008 18:33
From: Lee Ponzu This is called "changing the requirements" and is not allowed. What, never heard of feature creep?  Something like this should work (not yet compiled; MAY need minor syntax fixes): float FRAME_DURATION = 1.0; list FRAME_ROTS; integer N_FRAMES;
rotation initialRot;
integer nextFrame = 0;
default { state_entry() { FRAME_ROTS = [ llAxisAngle2Rot(<0.0, 0.0, 1.0>, -PI_BY_TWO), ZERO_ROTATION, llAxisAngle2Rot(<0.0, 0.0, 1.0>, PI_BY_TWO), ZERO_ROTATION ]; N_FRAMES = llGetListLength(FRAME_ROTS);
initialRot = llGetRot();
llSetTimerEvent(FRAME_DURATION); }
timer() { rotation frameRot = llList2Rot(FRAME_ROTS, nextFrame); nextFrame = (nextFrame+1)%N_FRAMES;
// Reverse order of multiplication to rotate about GLOBAL axis llSetRot(frameRot*initialRot); } }
|
|
Charity Aker
Registered User
Join date: 6 May 2008
Posts: 10
|
Bows to the Great people here
12-01-2008 19:02
This one works great too,,,, smiles, does a happy dance, jumps up and down.
Thanks everyone.
Charity
|