# Parabolic Projectile Trajectory

1. Jan 27, 2010

### rcrumb

Hi,

Im currently working on a video game, and have come to an aspect that I'm very unsure about (I'm self taught in most of my game physics knowledge, so there are quite a few gaps). Lets say there is an environment with no features that act on objects except for gravity (or simply no wind resistance). I am shooting a cannonball from a specific x,y,z coordinate, and am trying to hit another x,y,z coordinate. The cannon is going to be at a consistent angle (lets say 45 degrees). Is there an equation that i could use, where starting from one x,y,z location, i could calculate the rotation, velocity, and gravity to hit the exact other x,y,z location? Is this calculation possible, or will I always get "just very close" to the ending x,y,z location?

Thanks.

2. Jan 27, 2010

### dacruick

yes this calculation is possible. how do you want rotation and wind resistance to play a part? i suggest that since its a video game you neglect those.

3. Jan 27, 2010

### rcrumb

there will be no wind resistance. however, in terms of rotation if my canon was located at (300,200,0) and i had two targets, one at (350,250,0) and the other at (150,150,0) i was wondering if there is also a way to calculate the proper rotation to hit each target (one at a time).

4. Jan 27, 2010

### dacruick

what do you mean proper rotation. the only part rotation has to play is friction with the air. and if you are saying there is already no air resistance what does your rotation matter?

5. Jan 27, 2010

### dacruick

If for the purposes of your game you want to say that a spin of 1 revolution per second causes a force of 1 Newton in a direction perpendicular to the motion of the cannon ball that is fine, but not consistent with your physics

6. Jan 27, 2010

### rcrumb

oh sorry. i meant rotation of the canon itself (as if it were on a 360 degree swivel), so that it will point directly towards the next target. the ball will always follow a straight path to the target.

7. Jan 27, 2010

### dacruick

oh. yes then the equation is very solvable. you dont even have to keep your vertical angle fixed.

8. Jan 27, 2010

### rcrumb

interesting, is there a specific name/equation for doing these types of calculations?

9. Jan 27, 2010

### dacruick

yeah they are all kinemetics equations.

distance = velocity x time + 0.5 x acceleration x time² is one i might start with.
how much physics background do you have?

10. Jan 27, 2010

### rcrumb

not much, i've studied and programmed velocity, acceleration, and gravitational force before, but that's about it.

in the distance equation, what does the 0.5 represent?

11. Jan 27, 2010

### dacruick

thats a good question. i believe it is there because it is the time integral of at

12. Jan 27, 2010

### dacruick

but with that equation that i gave you, you have to be sure to split up all of your calculations into x direction y direction and z direction. so if you shoot a cannonball at 45 degrees in the air and you want to figure out the distance it will travel in the x direction, you will need to use the initial speed in the x direction. so it would be vsin45.

13. Jan 27, 2010

### dacruick

Also if you make all of those variables, you will have an infinite amount of solutions.

14. Jan 27, 2010

### rcrumb

very cool! thanks for all the help dacruick.