Jump to content

Rotate prim to face wind


Miguelito Shilova
 Share

You are about to reply to a thread that has been inactive for 4352 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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

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)>));    }}

 

  • Like 1
Link to comment
Share on other sites

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

You are about to reply to a thread that has been inactive for 4352 days.

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
 Share

×
×
  • Create New...