Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Parabolic Projectile Trajectory

  1. Jan 27, 2010 #1

    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?

  2. jcsd
  3. Jan 27, 2010 #2
    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.
  4. Jan 27, 2010 #3
    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).
  5. Jan 27, 2010 #4
    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?
  6. Jan 27, 2010 #5
    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
  7. Jan 27, 2010 #6
    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.
  8. Jan 27, 2010 #7
    oh. yes then the equation is very solvable. you dont even have to keep your vertical angle fixed.
  9. Jan 27, 2010 #8
    interesting, is there a specific name/equation for doing these types of calculations?
  10. Jan 27, 2010 #9
    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?
  11. Jan 27, 2010 #10
    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?
  12. Jan 27, 2010 #11
    thats a good question. i believe it is there because it is the time integral of at
  13. Jan 27, 2010 #12
    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.
  14. Jan 27, 2010 #13
    Also if you make all of those variables, you will have an infinite amount of solutions.
  15. Jan 27, 2010 #14
    very cool! thanks for all the help dacruick.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook