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?
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.