How to simulate wind?

500367065665a05a847242a39a0bc69e
0
mmakrzem 101 Dec 13, 2005 at 13:35

I’ve created some objects that have the following attributes:

a = acceleration
v = velocity
p = position
t = delta time

Right now, I am doing the following:
v += (a + gravity) * t;
p += v * t;

How do I incorporate wind? Lets say that I have a wind velocity = w. where would I put it in my equations?

I was thinking of doing this:
v += (a + gravity + w) * t;

but I don’t think this is right, because wind is not an acceleration…. it is a velocity.

So then I was thinking maybe:
v += (a + gravity) * t + w;

but because t is not constant then w does not change the velocity in a nice fasion.

What is the correct way to handle wind speed?

5 Replies

Please log in or register to post a reply.

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Dec 13, 2005 at 13:46

you can treat wind as a force, like gravity.

4a93ba032c357d782afb0820f328d14e
0
zavie 101 Dec 13, 2005 at 13:48

Quick and dirty way: just add wind’s velocity.

More realistic way: compute the surface the object is offering to the wind (a simple square, or maybe a real projection), and estimate the force resulting from the wind pushing this surface considering the wind as a pressure (F=PS if I recall correct). Then F=ma :-) The real problem is to get a nice P=f(Vwind) function.

Physically based way: implement some Ph.D thesis about fluid dynamics. ;-)

406ad7b52f4ed7443e3971e6b2adf430
0
kariem2k 101 Dec 13, 2005 at 15:10

yes treat it as a force not a velocity

also treat the gravity as a force not acceleration and treat them as vectors not scalar values.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Dec 13, 2005 at 15:18

Wind in itself is not a force, it just the velocity of air particles. What pushes your object is friction, which is relative to the wind’s velocity. If your object is moving along the direction of the wind, but slower, the wind makes your object moving faster. But if your object is moving faster than the wind, things are reversed: air resistance causes your object to slow down up until it has the same velocity as the wind.

So what you should do is incorporate air friction in your calculations. Calculate the relative wind direction by subtracting your object’s velocity from the wind velocity. This is the direction of the force, which you should multiply by a constant which describes how much air friction influinces your object. Divide this vector by the mass of the object to get the acceleration (F=m*a => a=F/m)

8a5fa29138fe68bea393768458910e16
0
opcode_foo 101 Dec 21, 2005 at 22:27

@mmakrzem

I’ve created some objects that have the following attributes:

a = acceleration
v = velocity
p = position
t = delta time

Right now, I am doing the following:
v += (a + gravity) * t;
p += v * t;

How do I incorporate wind? Lets say that I have a wind velocity = w. where would I put it in my equations?

I was thinking of doing this:
v += (a + gravity + w) * t;

but I don’t think this is right, because wind is not an acceleration…. it is a velocity.

So then I was thinking maybe:
v += (a + gravity) * t + w;

but because t is not constant then w does not change the velocity in a nice fasion.

What is the correct way to handle wind speed?

Well, for starters, your equations are just the simple kinematic equations, so no rigid body involved here. So, a wind you could treat just like a force applied from some direction. It would be a bit more involved in rigid body sim, but you would simplify and treat wind as a resistance force or just a directional force. Simulating it like a fluid mechanics problem would be … overkill ;-) In a car racing sim, you would model wind resistance, but treat it mostly uniform like a frictional force, and maybe a little more involvement, but you really don’t need much more complex modelling like this for a game, it will be realistic enough to believe it. Last, to get a more ‘windy’ feel, you could randomly perturb the wind force amount at times, like from hard to mild, none to tornado blast, etc…. just modulate the amount of pressure force the wind is putting on the object.

[EDIT]
Let me clarify by force, it would just become a velocity on the object, disregarding mass since it’s a particle you wind up

x = x0 + (v+wind_vx)*t
y = y0 + (v+wind_vy)*t - 0.5*g*t*t

And wind is a velocity in some direction. I just ignore the mass of the particle so the force ends up being a linear accel which than becomes
a constant applied to velocity …. but, that is not very rigorous, but it *works* in a video game sim.