I'm having trouble with some physics code. When the user presses an arrow key, it adds/subtracts 0.25 to the character's x velocity. Then the world steps, which should add/subtract 0.05 to get it closer to 0. This output of the velocity for each step shows what went wrong:
0.0 0.25 0.45 0.4 0.35000000000000003 0.30000000000000004
This gets things confused and the character will keep creeping along slowly in the same direction, while going through things it would normally collide with.
What might be wrong?
Rounding to 2 decimal places would work, but I want to see if there is a better way first.
When I jump, sometimes my feet get stuck in the ground, I'm assuming that's a related problem.