Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a game, and I need to simulate a the path of a cannon ball. I imagine I would have the initial velocity vector, and a vector for gravity. Is there a good tutorial on how to do this? (maybe I need to read some high school text books?)

share|improve this question

migrated from Nov 24 '11 at 21:15

This question came from our site for professional and enthusiast programmers.

Possibly of interest? - it's not great, but it's not a terrible starting point either. – awoodland Nov 24 '11 at 12:48

What I would do is learn how to use Cocos2d. You can use a function thats kind of like a timer, it is called 60 times a second by default but you can change this.

What you would do with this is update the x/y position of your sprite (the cannonball image) by a minuscule amount inside this time function, called ccTime.

If your actually looking for the math for the trajectory, here is an amazing tutorial on that

Here is a question on a forum very similar to yours

share|improve this answer

You show read the basics of the trajectory from where you can extract any equation you need.

If you google 'cannon ball trajectory' there is hundreds of tutorials of how to compute the position of an object following a cannon ball trajectory at any given time. Here there's an example

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.