I’ve searched but not found my exact problem so here it is:
Top down 2D game with a sprite character moving forward/backward/strafing with WASD/arrow keys. He looks at mouse. I move him with the following code (in Update). Using Unity 5.
transform.Translate ((transform.up*Input.GetAxis("Vertical") + transform.right*Input.GetAxis("Horizontal")).normalized *speed*Time.deltaTime);
The code works to move the character but the problem is the character keeps moving for about a half second after the input keys are released. This gives the controls a very unresponsive feel and the character seems as if he’s slipping across the floor.
If I only tap the key, the effect isn’t so bad, but if I hold it at all I get the problem. I should mention that if I hold the key for 1 second or for 60, he’ll stop moving after the same amount of time (about a half second). It doesn’t get worse the longer I hold, is what I mean to say.
Is there a better way to move the character? Put code in FixedUpdate but had the same problem.
Thanks for any help provided.