Slope limit on player movement

I have a player with a rigidbody. I add force tto the body for moving the player. My player walks over a terrain but is able to walk up mountains that are to steep to climb. I want to limit the player so it cannot walk up a slope that is to steep.

I know there is a CharacterController component that has this functionality, but I have to use the rigidbody, so I want the same but on my rigidbody.

I can get the normal of the triangle I am standing on, and calculate its angle, but I cannot seem to make the player stop moving up the slope. Only make the player stop moving (which makes the player unmovable once it hits a angled slope)

Any ideas how to solve this problem?

I learned the hard way that walking in a 3D environment can take some serious programming. There are a lot of instances you have to think about. I would recommend yoinking what is on the CharacterController and blending it in with yours, if you insist on using your own.

But a simple answer, by the sounds of it, try and do a check on where the player wants to move, not the current place the player is standing.

Thinking about it, that may not work exactly, because if they are walking down the slope, they will get stuck… Ya… just look through the CharacterController and figure out how it does it. If you plan on adding jumping, you are going to have a hell of a time if you want to use your own script.