continous 3d movement - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

continous 3d movement

how do,


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


cheers


dom

:)


Comments

  • : how do,


    : 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).


    : cheers


    : dom

    : :)


    It doesn't matter what you want to do in your

    program. 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 refreshing

    and system time are both triggered by the

    *programmable* interval timer.


    But since I don't know what operating system you

    use and I don't know what language you use, I

    can't say how to use it. So:


    If you have a Windows based language, you can use

    Windows to do your timing. Most likely there is

    command in the language to let a part of your code

    run at a constant rate.


    If you have a Dos based language you probably

    have to program the timer directly. PCGPE has a

    great document about programming the timer.


    If you have any other OS, I don't know how to do

    it, 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 a

    second is up to you. So I would say:


    make the code that changes the position of your

    objects. So that it don't matter wheter or not

    there is a frame drawn or not. This way you can

    have 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 need

    to use the timer: your code can be polling for

    a screen refresh or something else, and hooked to

    any number of events in the computer and probably

    a few other things I don't yet know of.


    THERE ARE PROBABLY ***FAR**** SUPERIOR WAYS OF

    DOING WHAT YOU WANT


    I hope this helped,


    BTM :-)


  • : : how do,



    : : 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).



    : : cheers



    : : dom

    : : :)



    : It doesn't matter what you want to do in your

    : program. 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 refreshing

    : and system time are both triggered by the

    : *programmable* interval timer.



    : But since I don't know what operating system you

    : use and I don't know what language you use, I

    : can't say how to use it. So:



    : If you have a Windows based language, you can use

    : Windows to do your timing. Most likely there is

    : command in the language to let a part of your code

    : run at a constant rate.



    : If you have a Dos based language you probably

    : have to program the timer directly. PCGPE has a

    : great document about programming the timer.



    : If you have any other OS, I don't know how to do

    : it, 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 a

    : second is up to you. So I would say:



    : make the code that changes the position of your

    : objects. So that it don't matter wheter or not

    : there is a frame drawn or not. This way you can

    : have 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 need

    : to use the timer: your code can be polling for

    : a screen refresh or something else, and hooked to

    : any number of events in the computer and probably

    : a few other things I don't yet know of.



    : THERE ARE PROBABLY ***FAR**** SUPERIOR WAYS OF

    : DOING WHAT YOU WANT



    : I hope this helped,



    : BTM :-)

    :





    A word of caution on this one. Be careful that you do not change the object-data (position, etc) while the drawing-routine is using it. This might result in some interesting effects when running a 5 fps.

    Better is to keep track of how many 'ticks' have passed since the last draw and then just moving it that many steps just before you start the next draw.


Sign In or Register to comment.