# How to retain constant velocity when friction increases

I'm writing a game and I'm trying to calculate how to retain a constant velocity no matter what the friction is. For example if the player has a velocity of 25, a mass of 40, friction is 0.1 (friction is constant) and acceleration can be calculated through: velocity / (mass + 5). Then I want that player to still have a velocity of 25. So what I'm after is some sort of formula using the acceleration in order to cancel out the friction, no matter what the friction is. Thank you for your time!

• Can you just set friction to 0? – user3482749 Nov 29 '18 at 16:04
• No, it's done s that if someone wants to change the friction the velocity should still remain the same, no matter what. @user3482749 – Blue shirt Nov 29 '18 at 16:08
• You're writing the game. Just write some code that sets friction to zero while this is going on, while keeping track of the actual friction in some other variable as it changes, then write the friction back to the variable when this constant-velocity state ends. – user3482749 Nov 29 '18 at 16:10