anyone know how to animate 3d objects (say moving from one place to another) at a constant (smooth) rate, when the frame rate differs (so 5 or 70fps still has the program running at the same speed, the graphics just look more jerky).
: anyone know how to animate 3d objects (say moving from one place to another) at a constant (smooth) rate, when the frame rate differs (so 5 or 70fps still has the program running at the same speed, the graphics just look more jerky).
It doesn't matter what you want to do in yourprogram. If something must be at a continues rate or at least is time related, you must use the Programmable Interval Timer.
This timer is used for almost any timing that's done in the computer. For example RAM refreshingand system time are both triggered by the *programmable* interval timer.
But since I don't know what operating system youuse and I don't know what language you use, Ican't say how to use it. So:
If you have a Windows based language, you can useWindows to do your timing. Most likely there iscommand in the language to let a part of your coderun at a constant rate.
If you have a Dos based language you probably have to program the timer directly. PCGPE has agreat document about programming the timer.
If you have any other OS, I don't know how to doit, but you can use the first two as a guide of where to look for.
CONCLUSION: it all comes down to this:
Make your code run a fixed number of times a second. (in this case use the PIT chip or a command in your computer language)
What code you let run a fixed number of times asecond is up to you. So I would say:
make the code that changes the position of yourobjects. So that it don't matter wheter or not there is a frame drawn or not. This way you canhave any framerate and still have your objects move as fast you damn well please.
OK, OK... I know what I explained is pretty fucked up and useless and I know you don't needto use the timer: your code can be polling fora screen refresh or something else, and hooked toany number of events in the computer and probablya few other things I don't yet know of.
THERE ARE PROBABLY ***FAR**** SUPERIOR WAYS OF DOING WHAT YOU WANT
I hope this helped,
It looks like you're new here. If you want to get involved, click one of these buttons!