Finding firing angle of a projectile with drag.

Click For Summary
The discussion focuses on calculating the firing angle of a projectile to hit a target while accounting for drag and air friction. The initial formula provided does not consider drag, leading to attempts to modify the distance calculations for XDist and YDist. Users discuss the complexities of modeling drag, noting that it is typically proportional to the square of velocity, complicating the calculations. The conversation emphasizes the need for a more sophisticated approach, such as solving differential equations numerically, to accurately determine the projectile's trajectory under the influence of drag. Ultimately, a simple formula for calculating distance lost due to air friction is deemed insufficient for precise targeting.
SirHall
Messages
22
Reaction score
1
To find the firing angle to hit a target at a given distance using the initial velocity and gravitational acceleration, we use the formula:
Angle = Firing
XDist = Distance the target is from the gun along the X axis
YDist = Distance the target is from the gun along the Y axis

Angle = radtodeg(arctan((power(Velocity, 2) + sqrt(abs(power(Velocity, 4) - Gravity * (Gravity * power(XDist, 2) + 2 * YDist * power(Velocity, 2))))) / (Gravity * XDist)))

However, I am trying to figure out a way to tell the formula to also account for drag/air friction. My main attempt was to add the distance the projectile loses to the XDist and YDist values, however I think that my scripts aren't exactly correct.
Any help would be greatly appreciated.
 

Attachments

  • Angle to fire Projectile.png
    Angle to fire Projectile.png
    1.6 KB · Views: 707
Physics news on Phys.org
Welcome to PF;
How are you modelling the drag?
Are you trying to do this on a spreadsheet?

Note: you will find it much easier to use LaTeX markup to write equations.
There is a primer here.
 
Simon Bridge said:
Welcome to PF;
How are you modelling the drag?
Are you trying to do this on a spreadsheet?

Note: you will find it much easier to use LaTeX markup to write equations.
There is a primer here.
Well, my main attempt was to try:
XDist = XDist + (XDist * 'airFriction')
YDist = YDist + (YDist * 'airFriction')
But I realized that this would only work if air friction was linear and if Speed = Speed - friction and not in a rel world evironment where drag is affected by speed aswell.
So, I took a look at the drag/air friction equation and it was actually very similar to what I have.
I use ForceDrag = -Velocity*Constant
In this case 'Constant' = 0.47
Therefore as the projectile moves through the air, speeding up and slowing down, the drag would shorten the distance the projectile travels.
If it's okay, I'm basically looking for a formula that determines how much distance will be lost due to air friction so I can add that distance onto the end of where the target is aiming, to compensate for said air friction.
Thanks for the LaTeX suggestion by the way.

EDIT: Projectiles only 'speed up and slow down' along the Y-Axis, while they simply slow down on the X-Axis.
 
Last edited:
SirHall said:
Well, my main attempt was to try:
XDist = XDist + (XDist * 'airFriction')
YDist = YDist + (YDist * 'airFriction')
But I realized that this would only work if air friction was linear and if Speed = Speed - friction and not in a real world evironment where drag is affected by speed aswell.
If I understand you correctly, XDist is the horizontal distance traveled without air resistance?
...so 'airFriction would be between 0 and -1 in that model.

So, I took a look at the drag/air friction equation and it was actually very similar to what I have.
I use ForceDrag = -Velocity*Constant
Drag would normally be proportional to the square of the velocity... unless there is something about the circumstances where you can safely take a 1st order approximation?

In this case 'Constant' = 0.47
Because ... ?

Therefore as the projectile moves through the air, speeding up and slowing down, the drag would shorten the distance the projectile travels.
If it's okay, I'm basically looking for a formula that determines how much distance will be lost due to air friction so I can add that distance onto the end of where the target is aiming, to compensate for said air friction.
Thanks for the LaTeX suggestion by the way.

You should start off the equations of motion ...
##\sum \vec F = m\vec a \implies -mg\hat\jmath -\sigma v\vec v = m\dot{\vec v}:## ## \vec v(0) = u\hat\imath\cos\theta + u\hat\jmath\sin\theta,## ## \vec r(0)=x_0\hat\imath + y_0\hat\jmath##
... where ##\sigma## is the drag coefficiant for the object in question.
Something like that?

Breaking that into components:

##m\ddot x +\sigma (\dot x^2+\dot y^2)\cos\theta = 0##
##m\ddot y + \sigma(\dot x^2+\dot y^2)\sin\theta +mg = 0##
... giving coupled differential equations.

You have to solve the system to give an expression for the final position, then, for it to work the way you ask, you need to subtract off the solution without drag.
If the idea is to do a computer simulation where the changes in position are very small, then you may get away with a 1st order version of the solution.
However, without knowing what you are trying to do, there is little more I can do to help.
 
Last edited:
Well thanks for that. Yes a computer simulation is what I'm using this for.
For more detail, I'm trying to figure out a formula that'll allow an AI to fire a projectile at the correct angle to land on a target at any given distance(Assuming it is within range). If the target's y was always equal to the cannon's y this would be simpler, but the AI is programmed to fire at targets at any x and y coordinate(y points downwards). In my specific case, the 'Constant' or C was set to 0.47 as it was simply a distinct number and I chose it just to make sure I didn't confuse it with anything else. Though in Fd = -VC, 'C' would 'act as' the Drag Coefficient. Also yes, XDist is the distance between the cannon and the target but only along the x axis. (Pretty much the difference between their x positions)

Also looked at the drag equation again, and slightly daunted as to how would I find the distance lost in a simple formula.

Will be testing the distances between projectiles with and without the air friction applied.
 

Attachments

  • daum_equation_1479185531420.png
    daum_equation_1479185531420.png
    2.6 KB · Views: 701
So far it looks like you have target coordinates, and muzzle velocity. You want the program to calculate the angle to hit the target coordinate dead on.
There is no simple formula ... and you should justify any approximations you make (ie. the linear drag model is very bad for the proposed purpose.)

The AI would probably solve the system of DE's numerically - pick your favorite method - or you could hand-solve the equations to find an analytic solution.

Note: I very seldom read pics.
 
Simon Bridge said:
So far it looks like you have target coordinates, and muzzle velocity. You want the program to calculate the angle to hit the target coordinate dead on.
There is no simple formula ... and you should justify any approximations you make (ie. the linear drag model is very bad for the proposed purpose.)

The AI would probably solve the system of DE's numerically - pick your favorite method - or you could hand-solve the equations to find an analytic solution.

Note: I very seldom read pics.
I see, thank you very much sir.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
Replies
3
Views
8K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
7K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
11K
  • · Replies 3 ·
Replies
3
Views
2K