I thought about this again...
and maybe you should get rid of the time-variable...
I don''t know how complex your program is, but with your current equations, you''ll have to remember a start-time or maintain a time-count for _each_ fired projectile.
maybe a better approach would be to save the current velocity of the projectile (using a vector) and update position (which is influenced by the velocity) and velocity (which is influenced by the current accelleration (ie: gravity).
updating position would, of course, be:
vec_pos += vec_v
updating the acceleration would be:
change of velocity = g * elapsed time
so, if g is represented as a vector (0, 0, -9.81)
vec_v += vec_g * (globaltime - lastupdate)
another advantage of this would be, that you could add dynamic influence, like changing wind... and you could easily add stuff like bouncing (simply said: if the projectile hits an horizontal floor, change the sign of the z-part of the current velocity)
nik
Physics
February 15, 2002 04:40 AM
LeMatsch gave such a simpler and more effective example than me there!! well done!...=0)
that''s just the sort of thing I was getting at.
..I''m gunna have to start loggin in aren''t I!!!
that''s just the sort of thing I was getting at.
..I''m gunna have to start loggin in aren''t I!!!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement