Be the first to post for 'Simulating Air Resistance'!

If you’re reading this, there probably aren’t very many posts yet. But don’t worry, you can be the first! Either create a new post or just reply to this one to say ‘hi’.

The Coefficient of air resistance is not unitless, it is in the units of kg/m because the speed squared is in m^2/s^2 and when multiplied by kg/m you get (kg m)/s^2 which is Newtons. That is in fact what the coefficient does, it converts from speed squared to newtons while applying a coefficient of proportionality.

3 Likes

Oh no! Getting called out on my physics knowledge (which is a bit rusty).

Do you remember where I say this in the video so that I can correct it?

Sam,

To start let me say AWESOME tutorial :slight_smile: I am having a blast with it, and
learning a TON, great job. The mistake in question is on section 4,
lecture 74, 8:36 into the lecture when you are talking about the formula
for air resistance.

Best Wishes,

Bill

1 Like

Cool, it should be uploading now.

Hey, I finished the tutorial series. Great job Sam, really enjoyed all of it and it is helping me in my product that I am working on. But, I always got confused on this part when talking about the drag coefficient unit.

According to wikipedia, the coefficient of air resistance is indeed dimensionless or unit-less. The Drag Force is what is (kg*m)/s^2, or equivalently “Newtons.”

I think this confusion that Bill had stemmed from the original formula, as we discussed it. It should be like this:

image

which includes DragArea.

So, to fix this in the code we would have the following:

   //DragCoefficient is indeed unitless! 0.3f - 0.5f is generally good to use. 0.3f - Tanks, 0.5f - Automobiles
	UPROPERTY(EditAnywhere)
		float DragCoefficient = 0.5f;
	//The DragArea that is (cm^2). Higher means more drag
	UPROPERTY(EditAnywhere)
		float DragArea = 20000.f;

Which, then we would multiply in our GetAirResistance() function.

Hopefully this makes sense.

1 Like

Yes, I think I was making it less physical in the course to simplify the equation to F is proportional to v^2 with C being the constant between them which would include rho, 1/2 and A

Hello! @sampattuzzi.

I’m working my way through the course and have spent the last several hours on this particular lecture trying to calculate air resistance. After a lot of google and wikipedia. I ultimately had to consult my friend who has a physics degree to make sure I understood everything.

First, the coefficient of drag is in fact dimensionless. This misclarification led to a headache of confusion, and referring to it in the resources was what sent me down this rabbit hole. While I’m glad to have learned a lot about physics today, I’d suggest removing it from the lecture.

Second, in regard’s to Mikhail’s post: A is not Drag Area but Cross Sectional Area.
Drag Area is calculated by multiplying the Drag Coefficient by Cross Sectional Area:

image

This means that the non-simplified function would look something like this:

	UPROPERTY(EditAnywhere)
	float DragCoefficient = ???;
	
	//The Cross Area (m^2) of our BoxExtent Y*Z. Mine is (240, 100, 74)
	UPROPERTY(EditAnywhere)
	float VehicleCrossArea = 74.f;

	//Using IUPAC Standard Temperature and Pressure measurement for dry air.
	UPROPERTY()
	float AirDensity = 1.2754;


return - Velocity.GetSafeNormal() * 0.5 * AirDensity * Velocity.SizeSquared() * DragCoefficient * VehicleCrossArea;

Note that this function isn’t possible to correctly calculate without knowing the drag coefficient, and puts us back to square one in attempting to find said coefficient. So back to the simplified formula.

In this particular case, our simplification strips away 0.5, rho, and A, like you said. The calculation each tick is now:

AirResistance = speed^2 * DragCoefficient

The problem for me was following the logical leap from that to calculating the drag coefficient, the slide shows it as follows:

AirResistance = Speed^2 * DragCoefficient
AirResistance / Speed^2 = DragCoefficient
10,000 / 25^2 = Drag Coefficient
Drag Coefficient = 16

You did briefly explain that you were using MaxDrivingForce and some arbitrary top speed.
Because Force is an instant measure of rate of change, when calling it each tick, it makes sense that the calculation for drag has a variable speed and thus variable air resistance.

Calculating the DragCoefficient itself is a function of:

MaxDrivingForce / TopSpeed^2 = DragCoefficent

This is where we circle back to the unitless vs unit confusion, the reason this is so important is that we’re using a simplified model of calculation for air resistance. As it was explained to me, differential equations often require simplification for the sake of computation speed and effectiveness.

Most shapes carry a drag coefficient somewhere between 0 and 2ish in real world physics. But again, because it’s a dimensionless number, it’s whatever aligns the model being used to real life observations.

Math is why I majored in Theater.

1 Like

Thanks for for sharing. In games you don’t always need exact physics, just approximations. This needs a whole other course (there is one!) discussing game maths.

Privacy & Terms