Game Development Community

True Aero/Fluid Wing Dynamics

by Bryce "Cogburn" Weiner · in Torque Game Engine · 07/20/2003 (7:25 am) · 6 replies

For the past 2 weeks I have been writting a airVehicle class and have been having some serious problems w/ vehicle physics, and I'm sure that it is simply due to my noob-ishness w/ the engine.

I have all of the requisite formulae for lift, and am using the following script-exposed parameters for flight surfaces: wingArea, engineThrust, verticleAileronArea, and horizontalAileronArea. I understand these are the basics, but that's all that I require for my implementation.

I have properly translated the force calculation equations that when run outside the Torque engine give proper results.

My problem is then taking these values and converting them into forces that are applied properly to the vehicle. For example, how would you apply the "lift" force in the updateForces method so that the vehicle behaves as it should for the given pitch of the wing? The most obvious is sFlyingVehicleGravity, but what physical force that represents in the engine is not exactly equitable to lift in true aerodynamics.

The way that forces are applied is a mystery to me. Simple tinkering with the values to learn via experimentation has yielded little understanding.

I have every intention of submitting the finished class as my first resource because I'm sure that someone will find this usefull considering the force equations for submarines and boats are almost identical to that of airplanes.

Any help will not only be appreciated, but credit will be given as due. I'd be happy to post the code itself if asked and it will be of some help to figure this out. Just didn't want to spam useless crap w/o requirement. :)

TIA

#1
07/20/2003 (12:24 pm)
There is an applyForce method... perhaps that would be useful in this context? It lets you apply a force at a location on the object.
#2
07/21/2003 (7:08 am)
I shouldn't post questions after staying up all night :)

Let me rephrase: What variable should be manipulated to force an object to go upwards?

Allow me to post some code.

Point3F rot(-mAtan(vec.z, mSqrt(vec.x*vec.x + vec.y*vec.y)), mDot(xv2,Point3F(0,0,1)), -mAtan(-vec.x,vec.y) );
	F32 pitch = mRadToDeg(-rot.x);	 // Pitch
	Point3F force  = Point3F(0, 0, -(netMass * 9.6));
	F32 netVelocity = mThrust.x * (mDataBlock->maneuveringForce) * mDot(xv,mRigid.linVelocity);
	lift = (((netMass * 9.6) * sin(pitch)) - mDataBlock->drag) * netVelocity;

How would I add in lift to the force variable so that it causes the object to rise?

Currently I have:
force += zv * lift * mCeilingFactor;;

But while the object does move in a forward direction w/ the appropriate velocity for the angle, it is consistantly pulled downward by the force of gravity.

Perhaps my values for the exposed variables are too low to overcomet the force of gravity. How would I display a variable such as lift in the sim to check its value?

When forces are applied, they are applied in the proper places, it's just not having the fully intended effect.
#3
07/21/2003 (8:00 am)
Why not just apply your result to the gravity and negate it directly. Just make the gravity variable for that vehicle instead of a fixed value and manipulate it, same end result.
#4
07/21/2003 (8:12 am)
Lift and lack of gravity are not the same. the 2 methods would handle very differently
#5
07/21/2003 (3:31 pm)
Which is my point exactly, James.

The point here is to make a basis for a realistic flight physics model that can be made more complex over time. If you wanted to add in drag and/or lift forces based on the current wind/weather conditions, simply modifying the vehicle gravity would not have the intended effect. That was my idea for the first (and second) attempt at trying to do this before I realized that it was just plain wrong for the effects desired.

It's just this ONE issue of lift that's giving me fits.

Suddenly I had an epiphany while rereading my code.

Gravity is 9.6 m/s^2. I have gravity being figured as 9.6 each time updateForces is called. This would imply that updateForces is being called once per second. I think my force of gravity is too high.

What is the length "timeslice" in which updateForces is called? Should not the coefficent of gravity be scaled to that timeslice accordingly? How do I tell what that is?
#6
07/21/2003 (4:00 pm)
The server updates at 32ms intervals, I'd say that youre getting the updates at that frequency.

What you need to do, is apply your forces in model space, then use the object->world transform to transform those forces into world space and then apply those to the model.

The model has an mObjectToWorld Matrix (if i recall), which is the object->world transform i mentioned before. Try applying your vector values by multiplying them by the inverse of that matrix (to get world space forces) and that should have some effect :) (of course, I dont guarantee the correct one).

Phil.