Best way to move an object

Started by
1 comment, last by griffenjam 22 years, 5 months ago
I am currenty having problems moving an object I''m using this mothod to see how far to move the object. (cMissiles.fSpeed * (gametime - cMissiles.fTimeLastMove) It has a set speed to move each millisecond and computes the time since the last movement then multiplies that by the move speed. It works well but everytime there is a small processer hit the missile jumps. Also I have a particle engine placing a particle behind the missile every frame, so if the missile jumps there is a gap in the particles. I thought about only updating the missile every 5ms but then on slow systems it wouldn''t run right. Any suggestions? </i> Jason Mickela ICQ : 873518 E-Mail: jmickela@sbcglobal.net —————————— "Evil attacks from all sides but the greatest evil attacks from within." Me —————————— <IMG SRC="http://www.crosswinds.net/~druidgames/resist.jpg">
"The paths of glory lead but to the grave." - Thomas GrayMy Stupid BlogMy Online Photo Gallery
Advertisement
Try basing your movements off of FPS or some other timefactor variable instead of hard time data. Then you can calculate an ''averaged'' FPS or timefactor over some number of frames (I use about 10.) This will mimimize sudden speeding up and slowing down, while still adapting to the speed of the PC you''re running on.
Update it each frame, keeping in mind the amount that time has changed between each one. On slow computers this will cause the object to "jump" but it will be kept in sync.

This topic is closed to new replies.

Advertisement