I’m programming a game in 2d and I would very much like to find a formula that is simple and efficient to get the character to recognize the slopes and go up and down without slipping, I’ve searched a lot on the internet for something that can help but not successful still, if anyone can help me thank you too much!
I already found many similar doubts but I still did not find one that would answer me because I am relatively new with programming still.
Sorry if I’m not clear, I’m using google translate to communicate, because Brazilian and there is no material to study that explains it.
this video shows in practice what I would like to achieve:
The explanation seems very complex, I tried to do it but I did not succeed.
explaining once more in detail:
I have a character body that uses Rigidbody.velocity to move around and its collisor is a capsule. Both the character and the Ground have no friction material. When I go through inclinations I get too much to climb, and I slide when I stop adding speed.
So what I would like to achieve would be basically a way to detect the slope of the ground and stabilize the body on top of it, so I can climb up and down without grabbing or slipping, as in platform games like Super Mario, Donkey Kong Country. I’ve been trying for a long time for a solution and thank you very much if anyone can help me!

Well… if detection of the slope is what you want, then perhaps you could find out what are you colliding with, using OnCollisionEnter() and somehow decide if it’s a slope or not. Since I am not sure about your game mechanic, whether slope is a special place (and the character is climbing it eg. with arope or a pickaxe) or if it’s just a sloped surface where the character walks normally) it’s up to you to define the slope. Could be a gameObject somehow explicitly marked to be a slope (having a component, name, tag, etc) or it could simply be any sloped surface, in which case you would be interested in the collision normal, a vector pointing away from the surface you are standing on. You could then see how much this normal deviates from UP vector (by using Vector dot product / )
BUT, if you are not really all that interested in detection of the slope and you simply want to walk on it without slipping, while keeping all the normal character’s behaviour (and physics properties) thenthe easiest solution would be to add a strong friction to the character’s collider (or perhaps the slope collider or both)