simply.. fix speed in any fps rate.. other method

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
pakata
Posts: 18
Joined: Tue Sep 23, 2008 11:51 pm
Location: korea rep of

simply.. fix speed in any fps rate.. other method

Post by pakata »

in high FPS like 300 frame per sec
caculating is so fast
it cause something problem ex)move faster....
in low fps like 7frame per sec
cant move...

Code: Select all

float speedfixed=0,speedcriterion=500; 

speedfixed=float(speedcriterion/float(driver->getFPS()));
10 fps speed = 50 processed 1 sec 10x50=500
100 fps speed = 5 processed 1 sec 100x5=500
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

you have to multiply it with deltaT

Code: Select all

	oldtime = timer;
	timer = (f32)device->getTimer()->getTime() / 1000.0f;
	deltaT = timer - oldtime;
pakata
Posts: 18
Joined: Tue Sep 23, 2008 11:51 pm
Location: korea rep of

Post by pakata »

need timer?
some confuse with sentence... ;;
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Don't use getFPS().

Code: Select all

   u32 then = device->getTimer()->getTime();

    while(device->run())
    {
        const u32 now = device->getTimer()->getTime();
        const f32 delta = (now - then) * .001f;
        then = now; 

        //... the rest of your main loop.
        // Multiply any movements or rotations by "delta"
    }
I can't really make it much simpler than that.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
pakata
Posts: 18
Joined: Tue Sep 23, 2008 11:51 pm
Location: korea rep of

Post by pakata »

thx @@
Post Reply