Hi all, i'm moving my objects according to when the last frame was rendered.
I want things to move every 10ms, but on slow computers this won't happen, and on fast computers i want think to move as smoothly as possible.
I'm currently moving objects using this as a way of altering there velocity according to the time passed:
where x is the actual velocity, and lastthink is the last time the object moved (the 10 is because i want things based on 10ms).Code:x*(GetTickCount()-LastThink)/10
I think this works ok, but i'm having trouble with acceleration. I'm currently doing this to gradually reduce the speed of my object:This doesn't work, the object slows down faster when i'm on a fast computer (and it's called a lot), but takes ages to slow down on a slow computer (when it's not called as often).Code:Velocity *= 0.98
To fix this i tried using this (pow is a funciton calculating is 1st parameter raised to the power of its 2nd parameter.):This doesn't work either unfortunatly. :(Code:velocity *= pow(0.98f,(float)((GetTickCount()-LastThink)/10))
Anyone have any ideas??
