Rigidbody2D.AddForce ends up going too fast... Anyway to set a maxSpeed? c#

Hello, I’ve pretty much finished my first 2D platform game, except I have an issue that I would really like to fix before I publish the game (which is being made for android/iphone), see I’m using a rigid body2D on my player and call Rigidbody2D.Addforce inside the player movement Script to initiate movement in the X-Axis, my question is can I set a max speed or somehow make sure the speed doesn’t end up too fast because after about a couple of minutes of gameplay my player ends up going too fast for anyone to be able to reasonably play… C# code is what I’m using/interested in.

float forwardSpeed = .1f;

void FixedUpdate(){

rigidbody2D.AddForce (Vector2.right * forwardSpeed);


After you call AddForce() do:

rigidbody2D.velocity = Vector2.ClampMagnitude(rigidbody2D.velocity, maxVelocity);

Vector2.ClampMagnitude reference page.