# Particle System and Air Resistance

This topic is 2808 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Put together a particle system which works well so far. Problem is air resistance. I added a parameter "drag" as in "air drag" or "air resistance". I'm still stumbling a bit over the math though. Air drag by itself in the real world is kind of a complex beast but for a game and in the case of particles one should be able to approximate it. Looking around I found something along this line:

particle.linearVelocity *= 1.0 - ( particle.drag * timeStep / particle.mass );

It seems to work but something bothers me. If I have wind for example then the impact of the wind on particles should be defined by the drag parameter too since this is the same case just with a velocity of ( wind.velocity - particle.linearVelocity ). But somehow this doesn't look right. A very light particle would obtain a huge wind force (since 1/mass goes to infinity for mass approaching 0).

Should this not be "* particle.mass" instead of "/ particle.mass"? Or do I have some broken math in there?

##### Share on other sites
Quote:
 Original post by RPTDBut somehow this doesn't look right. A very light particle would obtain a huge wind force (since 1/mass goes to infinity for mass approaching 0).

I think you mean a "huge wind acceleration," because the force wind would apply on a particle is not affected by the particle's mass. The force would be the same (since it depends on particle surface area), but the acceleration on the particle, given the same force and lower mass, would indeed be much higher.

Maybe it's okay, though. Once the particle catches up to the wind's velocity (i.e. the difference between the two is near zero), it will no longer accelerate really fast. It makes sense a lighter particle would catch up to wind's speed faster than a super heavy one.

How this all comes into play into your formula is a slightly different story, because your formula is a rough approximation. I'll let someone else cover that. ;D

##### Share on other sites
Hi,

At its most basic form, the equation for drag is something like this:

F = -kV^2

Where F is the force resisting the motion, k is a scalar that "encapsulates" not only the fluid's (air) density but also the particle's cross section and V is the velocity. We'll leave k for now and we'll assume V is a scalar too but in vector form the equation looks a little bit different.

So the drag force is really a function of how fast the object is moving but in your case I can't see evidence of that (unless particle.drag depends on the velocity of the particle).

You should implement something like the above equation even if its a simplification. Either that or make your equation somehow dependent on the velocity.

What you should realize is that if the particle's mass is very small, it will quickly gain velocity, true, but since the velocity increases quickly, the quadratic nature of the drag equation (the V^2) will "compensate" for this so after a while the particle's velocity will be as close to the wind's velocity as possible (without taking into account other factors right now).

So your equation may be written like this:

V = 1 - (kV^2*dt)/m

Since the acceleration is -kV^2/m (from before) and dt is the timestep. Again, this "integration" method is a basic euler method so its not accurate at large dt.

Anyway, you could write it in code like this:

float v = particle.linearVelocity; // just use v to simplify the code for us
v = 1.0f - ((particle.drag * v*v * timeStep) / particle.Mass);
particle.linearVelocity = v;

In this example, the particle.drag member is basically our k scalar. You can play with it to get desired results.

You can easily test if this works as its a very simple approximation. Hope it helps.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 14
• 30
• 13
• 11
• ### Forum Statistics

• Total Topics
631790
• Total Posts
3002365
×