int speedX = 5; // 30fps so its like bulletX is increased by (5*30)=150 every second. SetBulletX(bullet.X + speedX);
If I were to add air resistance to the above motion how will it be?
Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 11 May 2011 - 05:42 AM
Posted 11 May 2011 - 06:16 AM
I didn't read your original post.
Posted 11 May 2011 - 06:48 AM
Posted 11 May 2011 - 07:11 AM
Thanks for the help. I really appreciate it.
But its very complicated.
Posted 11 May 2011 - 07:44 AM
1 - find out how much time t has passed since the last frame (zero if its the first frame)
2 - calculate a
3 - change speedX by a * t
4 - change the position of the bullet by t * speedX
Posted 11 May 2011 - 07:54 AM
1 - find out how much time t has passed since the last frame (zero if its the first frame)
2 - calculate a
3 - change speedX by a * t
4 - change the position of the bullet by t * speedX
Assuming you're doing variable framerate physics, which is generally a bad idea.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.