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?)
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
migrated from stackoverflow.com Nov 24 '11 at 21:15
|
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 |
|||
|
|
|
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 |
|||
|
|
