This topic is now archived and is closed to further replies.


Projectile Motion Problem - PLEASE HELP

Recommended Posts

I am trying to work out how to make a missle or other object travel in an arc type form and being affected by wieght, wind, gravity, angle, and velocity. Any help would be greatly appreciated. [edited by - Razza2003 on March 4, 2003 5:23:49 AM]

Share this post

Link to post
Share on other sites
Fairly simple, assuming 3d vectors...

You need to have the following Vectors set up

1: Thrust = initial thrust of the projectile
2: Gravity = (0,-1,0)
3: Wind = e.g. (0.5, 0,0.01) for a slight diagonal wind
4: CurrentPos = position of projectile
5: CurrentSpeed = speed of projecticle
6: Accel = this frame''s acceleration

Every physics frame,

Accel = Thrust + Gravity + Wind
CurrentSpeed += Accel
CurrentPos += CurrentSpeed

If the projectile only has an initial thrust, then straight after the first frame you would zero the thrust component. Or, for missle-like projectiles, you could modify the thrust over time so that the projectile starts off accelerating, then looses power and behaves like a normal projectile.

The wind resistance is also pretty simple. Just create a scaling factor for your windresistance (e.g. 0.01) and add the following lines just before updating your position (gonna use DirectX function here)

D3DXVec3Normalize NormalOfCurrentSpeed,CurrentSpeed
D3DXVec3Scale WindResVector,CurrentSpeed,WindResistance

You can spend a bit more time on the calculation of the wind resistance, but that''ll do it close enough to fool the eye.

Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post

Link to post
Share on other sites
The drag force is found by roughly:

F = 0.5 * Cd * rho * A * U^2;

Cd = coefficient of drag
rho = density of the fluid
A = frontal area of object
U = velocity of the object

Take the F you get & divide it by the weight of the object in question & then subtract it from the acceleration term you''re using.

Easiest way to calculate Cd would be to figure out the terminal velocity of the object, from which you can know the force F, the rest of the equation are constants for a given object, so just rearrage it to get Cd.

Share this post

Link to post
Share on other sites