AddForce() and limiting speed due to friction.

I have two 2d rigid bodies. One is a box, and the other is a floor. The box has a mass, and is pulled down onto the floor by gravity. The floor has it’s position and rotation locked so it does not move. Both floor and box have 2d physics added, with a friction of 1.15 on each.

When i press a key, i use AddForce() to add some lateral (right/left) force to the box, and the box starts moving and then slows down to a stop. If i hold down the key, the box starts moving and keeps moving.

Now the problem is that the box continues to accelerate indefinitely while i hold the button. If i understand physics properly, it should at some point reach a terminal lateral velocity, and maintain it’s speed while i hold the button to apply constant force. Instead, the speed constantly rises forever.

I don’t want to manually set the velocity because this will mess up a lot of other things. Is there a way to get the friction to work properly?

You seem to be confusing friction with air resistance. Friction does not depend on relative speed so there is no terminal velocity due to friction. Air resistance does depend on relative speed so it does have a terminal velocity. It can be simulated using Rigidbody.drag.