I Need a simple Fix
|
Steel Masala
Registered User
Join date: 15 Sep 2007
Posts: 377
|
09-20-2009 11:10
OK,I have a simple rotation script I use in a prim in a build,I want to make it so the prim only rotates when you touch a a different prim on the build a"switch" I guess is what i need to turn the rotation on/off,any help will be greatly appreciated.
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
09-20-2009 11:48
There's probably as many different ways to do this as there are people in this forum. This is how I'd approach the problem. This would work by clicking the linkset as a whole integer toggle = TRUE;
default { state_entry() { // put you rotation command here.. using the word "toggle" in place of a number // toggle will be either 1 or 0, so you can use multiplication to get other numbers. llTargetOmega(<0,0,3> * toggle, 1, 1); }
touch_start(integer count) { toggle = !toggle; llTargetOmega(<0,0,3> * toggle, 1, 1); } }
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
09-20-2009 11:58
In prim A ... integer ON = FALSE; default { touch_start(integer num) { llRegionSay(-9900,(string)ON); ON = !ON; } }
In prim B ....
default { state_entry() { llListen(-9900,"","",""); }
listen(integer channel, string name, key id, string message) { if ((integer)message == TRUE) { llTargetOmega(< 0,0,1>,1,1); } else if ((integer)message == FALSE) { llTargetOmega(ZERO_VECTOR, 0,0); } } }
Untested but it ought to do the trick.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
09-20-2009 12:06
Here's a way to do it with one script.. name your switch prim "switch", then place this in the root prim of your linkset. integer toggle = TRUE;
default { state_entry() { // put you rotation command here.. using the word "toggle" in place of a number // toggle will be either 1 or 0, so you can use multiplication to get other numbers. llTargetOmega(<0,0,3> * toggle, 1, 1); }
touch_start(integer count) { if (llGetLinkName(llDetectedLinkNumber(0)) == "switch") { toggle = !toggle; llTargetOmega(<0,0,3> * toggle, 1, 1); } } }
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
Steel Masala
Registered User
Join date: 15 Sep 2007
Posts: 377
|
09-20-2009 12:57
rolig,would prim a, be the 1 I want to turn on rotation in?
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
09-20-2009 13:05
Prim A is the switch ... the one you click to make prim B rotate. Or, if you use Winter's cool method, prim A (the root prim) is the one you put the script in ... prim B is the one you want to rotate. ETA: Actually, you can use Winter's nice example to simplify my script B too. Just substitute the following for the listen event ...... listen (integer channel, string name, key id, string message) { llTargetOmega(< 0,0,1> * (integer)message, 1,1); }
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Steel Masala
Registered User
Join date: 15 Sep 2007
Posts: 377
|
09-20-2009 13:20
ok i used yours rolig,one problem,it spins the prim on the blue axis,i need the prim spinnig on the green axis,yanno like a lumberjack on a log in water rolling the log with feet trying not to fall in,lol
|
Steel Masala
Registered User
Join date: 15 Sep 2007
Posts: 377
|
09-20-2009 13:23
sorry i did not specify the rotation type
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
09-20-2009 13:26
So change the rotation axis. < 1,0,0> rotates on the X-axis, < 0,1,0> rotates on the Y-axis, and < 0,0,1> rotates on the Z-axis. Increasing the magnitude of the vector increases its spin rate, so Winter's example with < 0,0,3> rotates around the Z-axis three times as fast as mine does. Play with it until it spins the way you want it to.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Steel Masala
Registered User
Join date: 15 Sep 2007
Posts: 377
|
09-20-2009 13:34
awesome thx so much,  )
|
Steel Masala
Registered User
Join date: 15 Sep 2007
Posts: 377
|
09-20-2009 15:05
I got the axis fixed,now playing with other ideas in it,how do I make it so i can get OFF,LOW,MED,HIGH or is that even possible
|
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
|
09-20-2009 15:15
Hehe, this is a deliberate non-answer that will teach you more in the long run (although it won't actually be long before you've found the answer): You have three values you've entered in llTargetOmega() - axis, spinrate and gain Making them all zero stops the rotation Changing one (or more? you decide) or those to a negative value will reverse the rotation PLAY! Even with perfect documentation we only learn what works, what ELSE works and what other things may be possible if we experiment with the setitngs. Above all, we never UNDERSTAND a function and really remember it, until we've played around with it a lot [Edit: Whatever the question, now you've got the basics, just play with it]
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
09-20-2009 15:15
Experiment.  Use a minus sign. < 0,-1,0> is the reverse of < 0,1,0>.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
|
09-20-2009 15:19
Lol Rolig, I think we're saying very much the same thing here  @ Steel - you should take our encouragement to work it out for yourself as a compliment. You aren't asking step-by-step questions so we are assuming you're clever enough to understand without being told
|
Steel Masala
Registered User
Join date: 15 Sep 2007
Posts: 377
|
09-20-2009 15:47
okyou made me think,now my head hurt,lol,but u made me figure it out,ty,but when i link the 5 pieces together they all go crazy
|