# Libgdx Delta time stutter?

Alright, so I want my guy to move, I simply use this code.

velocity.y = speed;


Same goes for velocity.x Thing is, the lower the framerate the slower he moves.

But, if I add delta time, the player will sometimes, randomly, jitter back. Now I've traced the problem to be the delta time, but I don't know why. This is a small output of my delta time.

0.017027862
0.01713779
0.015907489
0.017954277
0.015993927
0.016019527
0.017010393
0.017026054
0.016008984
0.01701702


So it doesn't really vary that much per frame, still the jittering keeps happening.

Any possible solutions?

Delta time should not be used to calculate velocity, but position.

When you set velocity.y to speed, you are saying

"My character will move <speed> pixels per second in the y axis".


Later, when you update the actor's position you will calculate the y position by

character.position.y += velocity.y * deltaTime;