Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 stackoverflow.com Nov 24 '11 at 21:15

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

    
Possibly of interest? amazon.com/Physics-Game-Developers-David-Bourg/dp/0596000065 - it's not great, but it's not a terrible starting point either. –  awoodland Nov 24 '11 at 12:48

2 Answers 2

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

 
discard

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