# Projectile Range equation

This topic is 3152 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi to all guys i am not good in physics and trigonometric I tried to do a projectile system.My launch point is higher than target point.I know the velocity v, target_distance d, gravity g,Launch_height_y y0.I added a link that shows the equation.I tried my own but not solved the equation.Please some one help me.Thanks in advance. d = 30,v = 22 , g = 9.8 ,y0 = 2 I wants to find the theta(angle)

##### Share on other sites
Ideally, solve for theta: http://en.wikipedia.org/wiki/Range_of_a_projectile
If you're going for an AI of some sort, (like for a 2D tank game?) you can just approximate it by assuming the ground is flat:
theta = (1/2)*arcsin(d*g/(v^2))
If you want slightly better accuracy, you can try adding to theta if the target is lower and subtracting from theta if the target is higher. You can also do this iteratively to get an increasingly accurate answer.
-G

##### Share on other sites
If this is for the AI in a game somewhat like Worms etc, then I think one approach is to generate a set number of random angles, simulate the projectile path for each one of those, and pick the one that gets the closest to the target. Then to increase the difficulty level of your AI opponent, you simply pick more random angles simulating more projectile paths.

This makes the game easily have a varying diffulty level, as well as making it harder for the computer AI to get you when it would be harder for the human player to get you.
Note also, that if you wanted to later add additional forces such as wind or air-resistance, this would easily be added to a system such as the above, whereas solving a formula for the angle would get increasingly difficult if you added more forces.

This may all not be relevant at all for what you're doing, so if I'm way off base here just ignore this. I also realise that not everyone posting on this site is working on a game.

##### Share on other sites
After much deliberation on the problem, I think it may be impossible to derive an exact solution for theta. This really annoys me.

For the record, I think I distilled the equation down to:
((d*d*g)/(v*v)) - y0 = y0*cos(theta)+d*sin(theta)

My TI-89 Titanium calculator can't get further with that either :P

1. 1
Rutin
25
2. 2
3. 3
4. 4
5. 5

• 9
• 10
• 13
• 19
• 14
• ### Forum Statistics

• Total Topics
632943
• Total Posts
3009353
• ### Who's Online (See full list)

There are no registered users currently online

×