Help with adding air resistance into my projectile trajectory function

In summary: Adding all those factors would be very difficult. Having a difference in height is easy enough. But, for all three you'd need a very sophiosticated model.
  • #1
CraterHater
2
0
Hey,

I am working on a video game in which there will be archers who have the ability to shoot at enemies. My game is two dimensional and I am trying to calculate the angle at which the archer, given an initial velocity, has to shoot in order to hit the target perfectly. I came up with the following equation:

α = ½ * asin (-(-G * S)/V02)

Where α is the angle at which the archer has to shoot.
G is the gravitational constant.
S is the distance to the target.
and V0 the initial velocity of the target.

This function works to calculate the angle but it does not take into account several factors which I do want to take into account. These are:
- Air resistance.
- Differences in height between the archer and the target. Right now it assumes both are at the same height.
- Initial velocity of the target. The target is probably not stationary and so the formula should take the initial velocity into account in order to predict where the target will be on projectile impact.

I graduated high school last year and have never been the best at physics though I think this should be possible in a single equation. Can anyone help me out? Thanks!
 
Physics news on Phys.org
  • #2
CraterHater said:
Summary:: Hey,

I am working on a video game in which there will be archers who have the ability to shoot at enemies. My game is two dimensional and I am trying to calculate the angle at which the archer, given an initial velocity, has to shoot in order to hit the target perfectly. I came up with the following equation:

α = ½ * asin (-(-G * S)/V02)

I need to add the following conditions to make it work more realistically though:
- Air resistance
- Variable Height
- Target Initial Velocity

Hey,

I am working on a video game in which there will be archers who have the ability to shoot at enemies. My game is two dimensional and I am trying to calculate the angle at which the archer, given an initial velocity, has to shoot in order to hit the target perfectly. I came up with the following equation:

α = ½ * asin (-(-G * S)/V02)

Where α is the angle at which the archer has to shoot.
G is the gravitational constant.
S is the distance to the target.
and V0 the initial velocity of the target.

This function works to calculate the angle but it does not take into account several factors which I do want to take into account. These are:
- Air resistance.
- Differences in height between the archer and the target. Right now it assumes both are at the same height.
- Initial velocity of the target. The target is probably not stationary and so the formula should take the initial velocity into account in order to predict where the target will be on projectile impact.

I graduated high school last year and have never been the best at physics though I think this should be possible in a single equation. Can anyone help me out? Thanks!

Adding all those factors would be very difficult. Having a difference in height is easy enough. But, for all three you'd need a very sophiosticated model.
 
  • #3
PeroK said:
Adding all those factors would be very difficult. Having a difference in height is easy enough. But, for all three you'd need a very sophiosticated model.
Mhm, how would you approach this problem? I learned some things about computational physics. Would that be a good approach?
 
  • #4
CraterHater said:
Mhm, how would you approach this problem? I learned some things about computational physics. Would that be a good approach?

I'm not sure about air resistance for an arrow. You'd need some data on how an arrow is affected. It's not just how to compute equations numerically but what sort of equations you would generate in the first place.
 
  • #6
Including air resistance, unless friction force is assumed proportional to velocity (which is a poor assumption; it's more like proportional to the square of the velocity), the equation of motion is non-linear so a closed-form solution is out. I'm guessing your only avenue would be some kind of numerical simulation to which I think post 3 alludes. You might amuse yourself trying that in Excel.

The other parameters you list can all be included in your (linear) equation of motion. Laborious but entirely doable.
 
  • #7
  • #8
  • #9
In a video game, I would not worry about getting the physics exactly right. Just calculate a reasonably-shaped path to the target and have the arrow follow that path. The flight of an arrow is so fast that no player can tell if the physics is exactly correct.
 

1. How do I add air resistance into my projectile trajectory function?

To add air resistance into your projectile trajectory function, you will need to incorporate the drag force equation into your calculations. This equation takes into account the density of the air, the velocity of the object, and the cross-sectional area of the object. You can then use this drag force to adjust the acceleration and ultimately the trajectory of your projectile.

2. Why is it important to consider air resistance in projectile motion?

Air resistance, also known as drag, is a force that opposes the motion of an object through the air. In projectile motion, this force can significantly affect the trajectory of the object, causing it to deviate from its expected path. Therefore, it is important to consider air resistance in order to accurately predict the motion of a projectile.

3. Can I use a simple formula to account for air resistance in my function?

No, a simple formula may not accurately account for air resistance in your function. The drag force equation takes into account various factors such as air density and object velocity, which cannot be accurately represented by a single formula. It is important to use the proper equation to ensure the accuracy of your calculations.

4. How does air density affect the trajectory of a projectile?

Air density plays a significant role in the amount of air resistance experienced by a projectile. As air density increases, the drag force also increases, which can cause the projectile to slow down and deviate from its expected path. Therefore, it is important to consider air density when accounting for air resistance in a projectile trajectory function.

5. Are there any simplifications or assumptions I can make when adding air resistance into my function?

While there are some simplifications and assumptions that can be made when adding air resistance into a projectile trajectory function, these may result in less accurate calculations. For example, you may assume a constant air density or a constant drag coefficient, but these assumptions may not hold true in all scenarios. It is best to use the full drag force equation to ensure the most accurate results.

Similar threads

Replies
11
Views
1K
Replies
13
Views
2K
Replies
7
Views
6K
  • Electromagnetism
Replies
2
Views
1K
Replies
3
Views
1K
  • Introductory Physics Homework Help
Replies
13
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
283
Replies
4
Views
1K
  • Mechanics
Replies
6
Views
914
Back
Top