I'm still working on my game engine. I have gravity down, but now I need air resistance so that my objects can reach terminal velocity.
My objects' shapes and sizes will vary, so I want air resistance to be greater on some objects (flat ones) and lesser on some (skinny objects). How do I do this?
Note: I am using directX sdk.
this involves some drag physics...not 100% sure on the matter but i think I can point you in the right direction
hope that helps
Ugh, this is informative, but confusing. I've learnt that the total force is equal to the mass of the object times acceleration due to gravity (9.81).
So I figure I'd have to give each frame a mass to get the gravity right, but how would I code this? Right now I tell each frame to increase it's speed downward by 0.00981 every, well I'm not sure what it is, but if a second is 1000 on a timer interval, this timer is set to 1, so I used this decimal to make the net force increase by 9.81 metres/s/s.
So where exactly does the mass come in?
The earth will exert a force on the object. Its force is 9.8 m/s^2 times the mass of the object. Air resistance will exert another force on the object. However air resistance is extremely complex (to date we can only really "model" it) so you'll have to make some simplifications for it. The sum of the two forces is the net force on the object. You then got back to your F=ma formula to the find the acceleration.
I once did a projectile motion program with inelastic bouncing, etc.
Unfortunately, I only did a simple air resistance based on the square of the velocity of the object, and not based on the shape. Now that I think of it, it would be VERY hard to do it base on the shape :(
Well, you'd probably need to put drag coefficients, weights and a reference area for each object, then you'd solve D=1/2pv^2ACd.
D = drag
p = air density, just go with about 1.225 kilograms per cubic meter, you don't need to be that precise to deal with changing air density with altitude.
v = velocity
A = reference area
Cd = Coefficient of drag
Now you've got your drag, and your acceleration due to gravity of 9.8 m/s/s, add the two vectors together and you should get the actual acceleration, then from there you can work out how much to move the object by each time.
Reference area would be the downwards facing area, so in a triangle, point upwards it would be the area of the base.
Drag coefficient, probably you'd be able to find a list of common ones somewhere, like a 1.5'' smooth sphere has a Cd of about .5-.6 I think.
And I also wish to mention that use of this information is at your own risk because I'm not really that sure about it all ><