# How can I stop my character's velocity in only one direction?

I'm moving a character by setting its velocity. It works perfectly and stops how I want it to however when I'm moving forwards and sideways at the same time and I stop moving either sideways or forwards it stops my character's movement entirely which makes it need to accelerate again making it feel kind of jittery. This is an issue because it feels very odd and I would like my character to be able to strafe.

Here are the Functions I'm Calling In Update

private void UserInput()
{

if (Input.GetKey(KeyCode.W))
{
Forward = true;
}
else
{
Forward = false;
}

if (Input.GetKey(KeyCode.S))
{
Backward = true;
}
else
{
Backward = false;
}

if (Input.GetKey(KeyCode.D))
{
Right = true;
}
else
{
Right = false;
}

if (Input.GetKey(KeyCode.A))
{
Left = true;
}
else
{
Left = false;
}

}

private void Movement()
{

if (transform.position.y <= -40)
{
transform.position = new Vector3(0, 4, 0);
Delta = new Vector3(0, 4, 0);
}

if (AnimController.GetInteger("AnimPar") != 3)
{

if ((Left != true && Right != true && Forward != true && Backward != true) || (Input.GetKeyUp(KeyCode.A)) || (Input.GetKeyUp(KeyCode.D)) || (Input.GetKeyUp(KeyCode.S)) || (Input.GetKeyUp(KeyCode.W)))
{
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
Delta = transform.position;

}

if (Input.GetKey(KeyCode.LeftShift))
{
walkSpeed = initialWalkSpeed * 2;
}
else
{
walkSpeed = initialWalkSpeed;
}

if ((Forward && Right) || (Forward && Left) || (Backward && Right) || (Backward && Left))
{
walkSpeed *= .7f;
}

if (Forward)
{
Delta += transform.forward * walkSpeed * Time.deltaTime;
}

if (Backward)
{
Delta -= transform.forward * walkSpeed * Time.deltaTime;
}

if (Right)
{
Delta += transform.right * walkSpeed * Time.deltaTime;
}

if (Left)
{
Delta -= transform.right * walkSpeed * Time.deltaTime;

}

if ((Left != true && Right != true && Forward != true && Backward != true) || (Input.GetKeyUp(KeyCode.A)) || (Input.GetKeyUp(KeyCode.D)) || (Input.GetKeyUp(KeyCode.S)) || (Input.GetKeyUp(KeyCode.W)))
{
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
Delta = transform.position;

}

rb.velocity = new Vector3(-(transform.position.x - Delta.x), rb.velocity.y, -(transform.position.z - Delta.z));

}
}


I've looked online for answers for hours so any help/advice would be greatly appreciated!