Help with adding air resistance into my projectile trajectory function

Click For Summary

Discussion Overview

The discussion revolves around the challenges of calculating the angle for an archer to shoot an arrow at a moving target in a two-dimensional video game. The participant seeks to enhance their existing equation by incorporating factors such as air resistance, height differences, and the initial velocity of the target.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant presents an equation for calculating the shooting angle but notes it does not account for air resistance, height differences, or target velocity.
  • Another participant suggests that adding all the factors would be difficult and implies that a sophisticated model would be necessary.
  • A participant questions how to approach the problem and mentions learning about computational physics as a potential method.
  • Concerns are raised about the complexity of modeling air resistance for arrows, with a suggestion that data on how arrows are affected would be needed.
  • It is noted that including air resistance leads to non-linear equations of motion, making closed-form solutions unlikely, and numerical simulations may be required.
  • Resources are shared that may assist in understanding projectile motion with air resistance and drag coefficients.
  • One participant suggests that in a video game context, precise physics may not be necessary, and a reasonably shaped path could suffice for gameplay.

Areas of Agreement / Disagreement

Participants express differing views on the feasibility of incorporating all requested factors into a single equation. There is no consensus on the best approach, with some advocating for numerical simulations while others suggest simpler methods may be sufficient for game design.

Contextual Notes

Participants highlight the limitations of the initial equation and the need for additional data and modeling techniques. The discussion reflects varying levels of comfort with the complexities of physics involved in the problem.

CraterHater
Messages
2
Reaction score
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
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.
 
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?
 
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.
 
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.
 
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.
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 7 ·
Replies
7
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K