Slopes & AddForce

I need the character not to break away from the surface during a sharp turn, but with the addition of AddForce, he could easily come off the surface.

One solution is to keep track of character’s grounded state and previous frame grounded state, and when character walks of a diagonal surface, modify its rigidbody velocity.

When character moves on ground (isGrounded) and suddenly is no longer grounded (wasGrounded and no longer isGrounded), it might be that character moved fast uphill, and then there is a plateau, but as character’s rigidbody has some velocity, it will fly into air.

To counter this, you could try to detect this and if this happens, you flatten the velocity on its vertical axis, and additionally also add some downward force to your rb. I’ve used this and it worked for my purposes. However, it isn’t that clear-cut - what if character was supposed to jump from a ramp, when there is no ground after ramp and what other special cases are there? Anyway, you can do additional checks to see if there is ground near below (using raycast for example) and only then apply this change in velocity.