title: Unity stop character controller jumping up mountains
body: <p>as most of you might know, the default character controller settings in unity allow you to simply jump up any mountain / hill, even if its more than the slope limit. Granted you can't WALK up it, but you can still jump up it while moving forwards.</p>
  
  <p>In an attempt to fix this, I used the code from another answer:</p>
  
  <pre><code>void OnControllerColliderHit(ControllerColliderHit hit)
  {
      float radian = cont.slopeLimit * Mathf.Deg2Rad;
      if (hit.normal.y &lt;= radian)
      {
          canJump = false;
  
  
      } else
      {
          canJump = true;
      }
  }
  </code></pre>
  
  <p>and in my update function I only jump if canJump is true (as you might have guessed)</p>
  
  <p>So it almost works as expected, when the player approaches slopes that are beyond the slope limit (I THINK at least, if my radians calculation was correct, 'cause I don't really get what hit.normal.y is, if that's the same as the slope limit or not, so I kind of guessed... if anyone can correct me on that, that would help.)</p>
  
  <p>Anyway, first of all I need to fix that fact that the character can't jump even when he's facing AWAY from the mountain, I don't know how to calculate if he's FACING the steep slope or not, only if he's colliding with it, so if anyone can help with that, that would be good, and (related):</p>
  
  <p>I also can't figure out how to stop the player from jumping on these steep slopes from far away and staying on them, if he jumps on them or ends up on them however, he should simply slide down the mountain until he's on a regular slope, but I have no idea ow to get the CharacterContrller to slide down things, and especially not only until he reaches a regular slope?</p>
  
  <p>Also it seems like this also applies (the fact taht he can't jump) to when the character is walking up stairs sometimes, but that's a big no-no 'cause he should always be able to jump up stairs if they're reasonably small enough, but I don't know how to differentiate between a terrain object and stairs...</p>
  
  <p>If anyone can at least answer one of these three issues, that would be great (but prefereably all of them 'cause it's all part of the same question: How to just get normal character sliding / jumping regarding slpoes and stuff! (even though that wasn't the official title)</p>