Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rotating around the center of a cylinder

Secks Saito
Registered User
Join date: 25 Sep 2004
Posts: 10
10-26-2004 07:48
hello!

I've tried a couple different methods without much success.

How would I go about rotating a wheel around the axis in the middle?

heres some psuedocode

on_touch {

Wheel rotates around y-axis(can be any axis, I can adjust the script, I'm not a complete noob).

}

wheel stops when touched again. I wasn;t sure if I should use a timer function or what.

Please help.

Thanks

Secks
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
10-26-2004 12:41
You can do that with a texture (the way I would do it)...

Let's say from the builders perspective, you make a cylinder. Typically the top will be side ZERO.

You can put your "wheel" texture on that surface only. Then thin out the cylinder and size to your specs.

Then inside the wheel put can put a script that uses llRotateTexture( float_angle,0)

perhaps you should put that in a loop that goes a random number of iterations, increasing the variable "float_angle" by a specified increment, then gradually change the increment till you slow and stop the rotation altogether.

You can do that with multiple states, or different timer speeds also.

I hope that is not too vague. :confused:
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
10-26-2004 18:53
Or, you could use llTargetOmega()

x=0
touch_start
-----if x==0
----------llTargetOmega(vector axis, PI, float gain) // set gain to 1.0
----------x=1
-----else
----------llTargetOmega(vector axis, PI, float gain) // set gain to 0.0
----------x=0

hmm, actually, i haven't tried using targetomega to stop rotation? Will setting gain to 0 stop it?
Secks Saito
Registered User
Join date: 25 Sep 2004
Posts: 10
10-26-2004 19:09
well its technically, not one peice...think of it as a pinwheel...a bunch of shaped linked together.
I'd like to spin it around the center axis.
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
10-26-2004 19:11
Make the center prim the root prim (select it last when selecting the linkset.) Place the script into that root prim.
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
10-27-2004 07:00
also take a look at the code they are talking about another thread: /54/1d/25777/1.html

Though what they are talking about is not what you are talking about exactly, the code should be similar, and you can get some ideas from that code.
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts