# How to mitigate when applying horizontal force to a rigidbody seems to overpower gravity?

I've started testing movement using the example code in this answer of making a body accelerate to a target velocity

    private void FixedUpdate()
{
Vector2 input = GetInput();

if (Mathf.Abs(input.x) > float.Epsilon || Mathf.Abs(input.y) > float.Epsilon)
{
Vector3 desiredVelocity = new Vector3(input.x * speed, 0f, input.y * speed);

Vector3 delta = desiredVelocity - body.velocity;
Vector3 acceleration = delta / Time.deltaTime;

if (acceleration.sqrMagnitude > maxAccel * maxAccel)
{
acceleration = acceleration.normalized * maxAccel;
}


Your desiredVelocity is constructed with a y component of zero, saying "I desire that this object should hover instead of falling," and the rest of the code then tries to honour this stated desire.
To fix that, just set delta.y = 0 before you calculate your acceleration, to say "I don't care about movement on the vertical axis — leave that unaffected by this input acceleration"