Problem Movement with Rigidbody.velocity

As shown in the figure, the capsule continues to move in the +x direction (the direction of another collision object).

The problem is that gravity does not work properly in this case.

[191135-스크린샷97.png|191135]

Rigidbody.Gravity was basically used. If there is no collision except for the floor, it works correctly.

Therefore, it is not a solution to use a high value of custom gravity.

As a result of analyzing Rigidbody.Info,

  1. Move the Capsule in the +x and +y directions.(OK)
  2. Collides with another object.(OK)
  3. Rigidbody.velocity.x changes to zero. (OK)
  4. Rigidbody.velocity.y changes close to zero. (Why?)

I ask for help like this due to lack of knowledge.

It can be awkward because I used a translator.

public class Movement : MonoBehaviour
{
    Vector2 direction = Vector2.zero;
    Vector3 velocity = Vector3.zero;
    Rigidbody rb;

    [SerializeField]
    private float speed = 3f;
    [SerializeField]
    private bool isJumpPressed;
    [SerializeField]
    private float jumpHeight = 2f;

    private void Awake()
    {
        rb = GetComponent<Rigidbody>();
    }

    private void FixedUpdate()
    {
        Move();
        Jump();
    }

    private void Jump()
    {
        if (!isJumpPressed) return;
        
        velocity.Set(velocity.x, jumpHeight, velocity.z);
        rb.velocity = velocity;
    }

    private void Move()
    {
        velocity.Set(direction.x * speed, rb.velocity.y, 0f);
        rb.velocity = velocity;
    }

    #region Input Events

    public void OnMove(InputAction.CallbackContext value)
    {
        direction = value.ReadValue<Vector2>();
    }

    public void OnJump(InputAction.CallbackContext value)
    {
        if (value.performed)
            isJumpPressed = true;
        else
            isJumpPressed = false;
    }

    #endregion
}

im new to coding and i dont rlly know much but i try putting a physics material on the wall and then turned it all to 0 and minimum and it worked fine exept when i walk into a wall i cant jump anymore until i walk into a wall again here my jumping script:
public float Force;

 private bool grounded = true;
 
 void OnCollisionEnter(Collision collision)
 {
     grounded = true;

 }
 void OnCollisionExit(Collision other)
 {
    grounded = false;
 }

void Update()
{
    if(grounded == true)
    {
       if (Input.GetKeyDown("space"))
        {
         GetComponent<Rigidbody>().velocity = new Vector3(0, Force, 0);
        }
    }

    if(grounded == false)
    {
        return;
    }
}