Why this works in 3D, but doesn't work in 2D?

Hello, I’m new to unity and I don’t understand why when I try to write jumps in a 2D game this way it doesn’t work with that kind of movement. If I remove the moving code, the jumps start working. But in 3D, the same code works without problems with movement and jumping. Why is this so and how can I manage it to work in 2D together?

2D

void FixedUpdate()
{
    if (Input.GetButtonDown("Jump"))
    {
        _rb.AddForce(Vector2.up * jumpSpeed, ForceMode2D.Impulse);
    }
    _rb.MovePosition(this.transform.position + hInput * Time.fixedDeltaTime * this.transform.right);
}

3D

void FixedUpdate()
    {
    if (Input.GetButtonDown("Jump"))
    {
        _rb.AddForce(Vector3.up * jumpVelocity, ForceMode.Impulse);
    }
    _rb.MovePosition(this.transform.position + this.transform.forward * vInput * Time.fixedDeltaTime);
}


In 2d, you are using this.transform.right in _rb.MovePosition() and in 3d, you are using this.transform.forward in _rb.MovePosition, I don’t think this is same code because this.transform.right changes x-axis and this.transform.forward changes z-axis. Try changing _rb.MovePosition(this.transform.position + hInput * Time.fixedDeltaTime * this.transform.right); to _rb.MovePosition(this.transform.position + hInput * Time.fixedDeltaTime * this.transform.forward); or _rb.MovePosition(_rb.position + hInput * Time.fixedDeltaTime * this.transform.forward); in 2d