Hi to all !
Month ago I start research smooth fixed constant moving.
I wrote this C++ code with Sfml after read this article >>
http://gafferongames.com/game-physics/fix-your-timestep/
Then was begun some tests.
And problem is !!!
Again I see a little bit laggy if You see some more time on movObject.
What my wrong ?
Maybe some improved interpolation needs ?
Please specify how to fix and achieve smooth moving using constant velocity.
Here sources (MSVS) >> https://www.dropbox.com/s/nkkegjudjtoosly/Moving%20object%20c%2B%2B.zip?dl=1
-
Here main code to easy fast read > http://pastebin.com/he8TMHgi
Thanks in advance!
Laggy sfml Moving object, how to fix it ?
Not an expert on Gaffer's stuff, but the thing that sticks out to me, it looks like your then interpolating prevState and currState, but those will basically be nearly the same because of that assignment.
accum += elTmeMicros;
while(accum >= tmeStep)
{
prevState = currState; // <-- What's this?
currState.x += velX * tmeStep;
currState.y += velY * tmeStep;
accum -= tmeStep;
}
Yes people - I fully understand interpolation.
My goal is to achieve smooth moving using constant velocity.
Using for this interpolation, extrapolation or some other simpler methods.
What you using for stable motion on different fps ?
Hope you can share your sources for understand.
Thank you !
it means that when rendering, you interpolate precisely between states on timesteps, not just render data from full timesteps.const double alpha = accumulator / dt;
State state = currentState * alpha + previousState * ( 1.0 - alpha );
render( state );
Nope Gaffer has prevState, currState and State (for interpolation). Here no deal !(
Please download my sources / binaries and look how moves object.
There no mistakes but I want more stable motion.
Maybe you advice me your own method to moving objects and code also ???
Yo no understand basic things of C++ language ?? (use -- cout << variable << endl;)
For what we now talking then, hmmmm.. ((
Its very difficult part of game development and no simple talking around this.
Otherwise need complete solution to fix motion.
My solution looks like sufficient but want more proper motion.
If you using somewhere Box2D you can see normal motion, but me need simple motion for simple constant velocity ONLY.
Thanks for responds!