Hi there, I’m working on a 2d game that’s from a top-down view, so there is no gravity or drag.
However at the moment if you stop pressing down on the keys, the character will still move for around a second in the direction it was moving.
Does anyone know what I can change so that the character will stop immediately after there is no input from the keys?
The keys being - A, W, S, D, and/or the arrow keys.
Thanks in any case, have a great day!
P.S I am using animator so that I can change the appearance of my character when is faces different directions.
void Update()
{
movement = new Vector3(moveX, moveY, 0.0f).normalized;
animator.SetFloat("Horizontal", movement.x);
animator.SetFloat("Vertical", movement.y);
animator.SetFloat("Magnitude", movement.magnitude);
}
private void FixedUpdate()
{
transform.position += movement * Time.deltaTime * move_Speed;
}