Script: Spinning Object
|
Peter Linden
Registered User
Join date: 18 Nov 2002
Posts: 177
|
04-14-2003 14:22
Spinning Object Summary: The following script will make an object spin. To use, merely create any single-primitive object, attach this script, and it will spin at a slow readable rate. Usage: This is a great script for spinning signs, rotating doors and silly attachments. It uses very little processing power and is amusing if the object is attached to your head. Script: default { state_entry() { llTargetOmega(<0,0,1>, 2, 2); } }
Notes: I've found that setting past 8 makes it spin a little too fast. To speed the rotation of the spinning object, merely change the line llTargetOmega(<0,0,1>, 2, 2); to read llTargetOmega(<0,0,1>, 3, 2); to go faster or llTargetOmega(<0,0,1>, 4, 2); to go even faster or llTargetOmega(<0,0,1>, 5, 2); to go yet faster. You get the idea. Credits: Script written by: Cory Linden 2-27-03 Modified and commented by: Peter Linden 3-3-03
|
RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
|
Original Thread
01-02-2005 00:39
/15/78/1899/1.htmlThis doesnt work if its attached to your av must a been nice when it did work
|
Draciav Svarog
Registered User
Join date: 12 Jan 2005
Posts: 1
|
01-17-2005 00:33
Is there anyway to get them to spin slower than the default?
|
Chromal Brodsky
ExperimentalMetaphysicist
Join date: 24 Feb 2004
Posts: 243
|
01-18-2005 07:37
From: Draciav Svarog Is there anyway to get them to spin slower than the default? Yes. The first argument to llTargetOmega() is a vector specifying rotation axis speeds in radians per second. Because a radian is Pi * 2, or approximately 6.28, for your typical non-physical object, llTargetOmega( <0,0,6.28>, 1, 1 ); should rotate it about one revolution per second, and, llTargetOmega( <0,0,0.628>, 1, 1 ); should rotate about once every ten seconds. The second parameter is spinrate, which you could also use to adjust the rate of spin. As I understand it, it acts as a multiplier on the first parameter. You can read more about how llTargetOmega() works here .
|
Chandra Page
Build! Code. Sleep?
Join date: 7 Oct 2004
Posts: 360
|
01-18-2005 10:47
From: Draciav Svarog Is there anyway to get them to spin slower than the default? Slower spin is simply a matter of using a smaller value for llTargetOmega's second parameter. For example, the following rotates at half the rate of Peter Linden's original example: default { state_entry() { llTargetOmega(<0,0,1>, 1, 2); } } You can achieve even slower rotation by using a fractional value for the spin rate parameter. I find that 0.5 works well for a rotating vendor display that I've built; it gives the object a little motion to attract attention, but doesn't spin so fast that it makes the customer nauseous.  If you're interested in precisely controlling the spin rate, you should keep in mind that the rate is measured in radians of rotation per second. There are 2 * PI radians around a circle, so to achieve a rate of one revolution per second, you could use the following: llTargetOmega(<0,0,1>, TWO_PI, 2); TWO_PI is an LSL constant equal to 2 * PI.
|
Lance LeFay
is a Thug
Join date: 1 May 2003
Posts: 1,488
|
01-20-2005 20:21
I have but one question for all of you..
WHY?!
_____________________
"Hoochie Hair is high on my list" - Andrew Linden "Adorable is 'they pay me to say you are cute'" -Barnesworth Anubis
|
Sudane Erato
Grump
Join date: 14 Nov 2004
Posts: 413
|
01-21-2005 07:52
My experiments with this appear to show that the rotation axes are always global. Could someone show a conversion to rotation around local axis?
Rotation is extremely complex!
Sudane
|
Chandra Page
Build! Code. Sleep?
Join date: 7 Oct 2004
Posts: 360
|
01-26-2005 12:19
From: Sudane Erato My experiments with this appear to show that the rotation axes are always global. Could someone show a conversion to rotation around local axis?
Rotation is extremely complex! I think this may do what you want, but I'm not in-world and I haven't tried it yet, so your mileage may vary: llTargetOmega(<0, 0, 1> * llGetRot(), 2, 2); In theory, this should rotate an object around its local Z-axis, rather than the global Z-axis. But it's only a theory. And yes, rotation makes my head hurt. I should have paid more attention in math classes, but the desk was so comfy, and the lecture hall was so warm, and the professor's voice was such a soothing monotone...
|
Mutamu Shark
Statistical Impossibility
Join date: 6 Jan 2005
Posts: 3
|
01-26-2005 15:28
the first 2 numbers: llTargetOmega(<0,0,1>, 1, 2); do something to axis but i have no idea what as sch >.> i want an object to rate when its put vertically, as it is a have spinning objects but you have to stand on em to look at em properly >.>
|
Sudane Erato
Grump
Join date: 14 Nov 2004
Posts: 413
|
01-27-2005 09:23
From: Chandra Page ... have paid more attention in math classes, but the desk was so comfy, and the lecture hall was so warm, and the professor's voice was such a soothing monotone... Hehe  Yes, my feelings exactly! Thanks for the code. I'll try it out. Sudane
|
Yoofaloof Pacer
Registered User
Join date: 12 Apr 2005
Posts: 27
|
Clockwise / Anti-clockwise
03-19-2006 09:17
How would you go about changing rotation of spin from clockwise to anti-clockwise?
|
Yoofaloof Pacer
Registered User
Join date: 12 Apr 2005
Posts: 27
|
03-20-2006 04:15
How do you get an object to spin in the opposite direction?
|
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
|
Discussion Thread
03-20-2006 08:47
_____________________
i've got nothing. 
|