- #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!
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!