Jump to content
Sign in to follow this  
dmarkwick

Get wind strength

Recommended Posts

Anyone know how to return the strength of the current wind?

As a lot of people here may know, I'm a-workin' on a smoke addon smile_o.gif problem is, when it looks good in still weather it looks crap in windy weather, & vice-versa.

So I want to make 2 of the parameters reactive to the wind strength. If I can make the particle rate increase when it's windy then it will look good when it's blowing away, but I need to reduce the particle lifetime accordingly. Likewise if i there's no wind I can drop the particle rate and increase the particle lifetime to get good tall smoke columns. So whatever the weather I can maintain a balance between good effects & number of particles.

But first I need a way to get the current wind strength smile_o.gif

Share this post


Link to post
Share on other sites

Wiki: Wind

Returns a three position array [X,Y,Z?]

X/Y are the direction/how fast the wind is moving and Z might be thermals?? Got me.

Just what i think it is.

Share this post


Link to post
Share on other sites

Z would likely be the vertical component of the wind vector.

All the vectors are in meters per second.

I'm under the impression particles just move with a constant velocity, right? If so, the best solution would simply be to add the wind vector to the smoke particles velocity, which means you don't need the total strength.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">smokeParticle setVelocity [(velocity smokeParticle select 0) + (wind select 0), ... ]

Share this post


Link to post
Share on other sites

LOL, thanks guys biggrin_o.gif if I'd just looked under "W" for wind I would have seen it, but I only looked under "G" for GetWind biggrin_o.gif never thought it would be so simple.

Cheers again.

*edit*

In order for me to use the above array usefully, I just need to multiply each array element by 1 right? to turn any negative values into positives?

Share this post


Link to post
Share on other sites

Nope, just add whatever the current wind vector element is, even if that element is negative.

Share this post


Link to post
Share on other sites
Nope, just add whatever the current wind vector element is, even if that element is negative.

Aah, I think I may have missed out an explanation biggrin_o.gif I just need the vector strength, not it's directional component. I intend to just use the first 2 array elements to get a general wind strength so I can affect particle lifetime and particle creation rate smile_o.gif whatever the direction is is unimportant at this stage.

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_strength = SQRT((wind select 0)^2 + (wind select 1)^2);

Share this post


Link to post
Share on other sites

Oh, okay. In that case you have two options : pythag or trig. I don't know which is more efficient, which may be important for lots of smoke. Any programmer should be able to tell you that, or you might need to test it. I'd ditch the Z component, it's generally very small.

pythag (roughly - ignoring the wind's Z component) :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">windSpeed = sqrt (((wind select 0)*(wind select 0)) + ((wind select 1)*(wind select 1))) result in m/s.

pythag (precise with more calculations due to including the Z component) :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">windSpeed = sqrt ( ( (wind select 0)*(wind select 0) ) + ( (wind select 1)*(wind select 1) ) + ( (wind select 2)*(wind select 2) ) ) result in m/s.

trig (rough - no Z)

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">windSpeed = (wind select 1) / cos ((wind select 0) atan2 (wind select 1))

trig (precise - with Z)

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">windSpeed = (wind select 2) / ( cos ((wind select 1) / cos ((wind select 0) atan2 (wind select 1)) atan2 (wind select 2) ) )

disclaimer - probably some mistakes in there : )

Share this post


Link to post
Share on other sites

Thanks guys, looks like you both gave me the same answer smile_o.gif I'll use it. Performance shouldn't be an issue as I'll do the check every 2 minutes or so.

Again, thanks smile_o.gif

Share this post


Link to post
Share on other sites

Part II:

I can't find any information about wind in ArmA, does anyone know what the min & max parameters are? Setting the weather seems to have very little (if any) influence on the wind speed, which seems to be entirely arbitrary.

Share this post


Link to post
Share on other sites

Don't really know, the most i have seen is almost 7 on X and 4 on Y with Z being 0.000214 or something like that at all times.

Would be interesting to know what the limits are.

Share this post


Link to post
Share on other sites

I want a command that sets the wind direction and strength.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×