|
Infrared Wind
Gridologist
Join date: 7 Jan 2007
Posts: 662
|
09-23-2007 09:45
I have a problem that hopefully will be simple to solve...I'm out of things to try... The script below is the standard bit for rotating an object on the z-axis. It works fine. But I want to rotate the prim on y-axis. This is for a wind gauge that is vertically oriented so that North would point to 12 o'clock (up), South to 6 o'clock, East to 3 and West to 9: default { state_entry() { llSetTimerEvent(2); } timer() { llSetLocalRot(llRotBetween(<1, 0, 0>, llWind(<0.0, 0.0, 0.0>  )); } } Thanks for any help... - Infrared
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
09-24-2007 04:55
Lots of ways to do this... probably simplest is just to use a prim type that looks right when rotated about Z (perhaps a tube instead of a cylinder?)... but just for fun, here's one scripted way: default { state_entry() { llSetTimerEvent(2); } timer() { llSetLocalRot(<0, 0.70711, 0, 0.70711> * llRotBetween(<1, 0, 0>, llWind(<0.0, 0.0, 0.0>))); } }
That cryptic rotation is just llEuler2Rot(<0, PI_BY_TWO, 0>  , by the way; just flipping the rotation 90 degrees. My natural inclination would have been to do the trig in the script, but llRotBetween is probably faster, actually.
|