I am building a character controller using only the Physics system (moving around using rb.AddForce).
Using some basic math I figured that to reach a given speed I could use this formula to determine the force to apply :
F = massVdrag / (1-drag*Time.FixedDeltaTime)
Calculated from :
V = V*(1-dragdt)
V = V+accelerationdt
a = F/mass
This works perfectly if I unable the gravity in the settings or straight up apply a force to counteract gravity. But with gravity on and while running on a flat surface, a pure horizontal movement, I don’t get the full speed. Why is gravity affecting my horizontal speed ?
Also if I increase the drag up to 99 I almost get my target speed but with a drap of 100 I can’t move at all anymore. Is it hard coded somewhere that 100 is a drag threshold to stop movement ?
You should check if any friction is applied. This would be enforced by gravity, as it would generate more collisions with the ground. Check the Physic materials on your colliders of both ground and the moving Rigidbody.