How do I prevent a a player from moving up a slope over X degrees?

I’ve seen this asked all over, but I haven’t seen an answer or any example code or a tutorial or anything. I have a tank, moves along and hits a slope. I don’t want it to angle up and go up the slope, I want to to stop / drive along the slope.

My movement code is basic, controlled by arrow keys. I want the player to have to jump up, not just drive up.

	if (_moveForward) {
		float moveAmount = moveSpeed * Time.deltaTime;
		_rigidbody.MovePosition(_rigidbody.position + _rigidbody.transform.forward * moveAmount);
	}
	if (_moveBackward) {
		float moveAmount = (-moveSpeed * 0.6f) * Time.deltaTime;
		_rigidbody.MovePosition(_rigidbody.position + _rigidbody.transform.forward * moveAmount);
	}

	if (_turnLeft) {
		Quaternion rotateAmount = Quaternion.Euler(new Vector3(0f, -angularSpeed, 0f) * Time.deltaTime);
		_rigidbody.MoveRotation(_rigidbody.rotation * rotateAmount);
	}
	if (_turnRight) {
		Quaternion rotateAmount = Quaternion.Euler(new Vector3(0f, angularSpeed, 0f) * Time.deltaTime);
		_rigidbody.MoveRotation(_rigidbody.rotation * rotateAmount);
	}

	if (_jump && _isGrounded) {
		_isJumping = true;
	}

	if (_isJumping && _jumpTimeLeft > 0) {
		float moveAmount = jumpSpeed * Time.deltaTime;
		_rigidbody.MovePosition(_rigidbody.position + _rigidbody.transform.up * moveAmount);

		_jumpTimeLeft -= Time.deltaTime;
	} else if (_isJumping) {
		_isJumping = false;
		_jumpTimeLeft = jumpTime;

	}

Angular Velocity might help you, just check what is the angular velocity of your tank on that slope and if it is more than your desired angle then simply stop your tank from moving any further … example below

public RigidBody tankRB;

void FixedUpdate(){
    if(tankRB.angularVelocity.magnitude > 10f){
        // This slope is too steep, so stop moving further
    }
}