Skip to main content
GameDev.net gamedev.net
🔒 Locked

Projectile Motion Problem - PLEASE HELP

Started by Razza2003 Mar 4, 2003 at 4:21 AM 2 replies 1.1k views
Original Post
Razza2003
Razza2003
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]
SoaringTortoise
SoaringTortoise
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
CurrentSpeed-=WindResVector

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.
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
NickB
NickB
The drag force is found by roughly:


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

where:
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.