Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Some kind of weathervane

Edicius Shakkyo
Registered User
Join date: 21 Aug 2006
Posts: 5
05-13-2009 22:41
Hello Hello all.

Im trying to figure something out. I want to make a weathervane. one that rotates in the direction of the wind.

the wind vectr is in the format <x,y, 0>

so if i am correct on this... i think i can take the LLTan (y/x)
and us that as the angle of rotation, right?

so if z = LLTan (y/x)
then i should be able to set angle =<0,0,z>*eulertorotate

then

llsetrot(llgetrot()*angle)

ok tried it... didnt seem to work... is there some way or order it needs to be done?

hhmmm... i have a bad habit of not saving the script to inventory and just leaving it in the object until it is completed. as such, i do not have it available to post here.

but by all means, this should work, right?


or do i just suck at calculus?
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
05-13-2009 22:59
You can use llRotBetween, tiny example in the comments here:

http://jira.secondlife.com/browse/SVC-3131

And I point to that JIRA page because llWind probably doesn't do what you hope.
Logan Bauer
Inept Adept
Join date: 13 Jun 2004
Posts: 2,237
05-13-2009 23:07
From: Viktoria Dovgal
You can use llRotBetween, tiny example in the comments here:

http://jira.secondlife.com/browse/SVC-3131

And I point to that JIRA page because llWind probably doesn't do what you hope.


I haven't done much with JIRA - shouldn't that issue be reopened? I want to vote for it but can't because it's showing "resolved"
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
05-13-2009 23:15
I think that anyone can reopen a closed issue. It would be nice to know what additional information was needed, since the reporter set up a test rig and the closer didn't explain why that wasn't enough. I'm always a little unsure if the best channel to ask stuff like that should be the JIRA itself, or someone's office hours or what.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-13-2009 23:37
Trig, you suck at Trig =) (j/k)

x and y are in vector form, so I think you actually need ATan( y / x ) and you need to watch out for x = 0 (and then you still have to watch your sign changes for direction)

ETA:
rot between will probably be the better choice though.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Edicius Shakkyo
Registered User
Join date: 21 Aug 2006
Posts: 5
05-13-2009 23:57
cool, thanks guys!

ill be back if there are more problems.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
For Free
05-14-2009 00:53
CODE

// wind sock script, Studio Dora, Dora Gustafson 2008-03-21

vector rotAxis = < 0.0, 1.0, 0.0 >; //the direction the object points, when not rotated
vector 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
}
}
_____________________
From Studio Dora
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-14-2009 01:04
should that be <1.0, 0.0, 0.0>?
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
05-14-2009 01:07
From: Void Singer
should that be <1.0, 0.0, 0.0>?
If you prefer:) it depends of what object you use. The Z part should always be zero.
EDIT: I take back what I said about the Z-part. The vector can be any vector but the ZERO_VECTOR
_____________________
From Studio Dora
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-14-2009 01:16
eh, gotcha, because of SL's peculiarity of assigning fwd to west I've gotten in the habit of building that direction for facing.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -