Miguelito Shilova Posted May 16, 2012 Share Posted May 16, 2012 I'm working on a boat project where the mainsail needs to rotate to face the wind (SL Wind) when not sailing. In essence, it needs to behave like a weathervane. I'm working with the BWWind script and what I'd like to do is create a routine that gets called during the global boat timer section of the script. I've seen examples of weathervane scripts, but they weren't part of a routine. Would someone be able to assist with the syntax and structure of such a routine?Thanks!Mig Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 16, 2012 Share Posted May 16, 2012 It isn't particularly obvious how to do it until you play with the math for a little bit. Here's a wind vane that works and should be easy enough to adapt for your use. At least it's something to play with ... :smileywink: default{ state_entry() { llSetTimerEvent(1.0); } timer() { vector wind = llWind(ZERO_VECTOR); llSetRot(llEuler2Rot(<0.0, 0.0, llAtan2(wind.y, wind.x)>)); }} 1 Link to comment Share on other sites More sharing options...
Dora Gustafson Posted May 16, 2012 Share Posted May 16, 2012 Another way to do it: // wind bag script, Studio Dora, Dora Gustafson 2008-03-21vector rotAxis = < 0.0, 1.0, 0.0 >; //the direction the object points, when not rotatedvector wind;default{ state_entry() { llSetTimerEvent( 5.0 ); } timer() { wind = llWind( ZERO_VECTOR ); if ( llVecMag( wind ) > 0.125 ) // if well defined then llSetRot( llRotBetween( rotAxis, wind )); // turn object axis in the wind's direction }} Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now