title: Making car drive up a slope
body: <p>I am creating a simple car game in Unity, and so far I have built the car and the enemy vehicles. I have a mountain which has a slanted road that goes up, over and down the mountain.</p>
  
  <p>Unfortunately, with my code so far, my car does not successfully climb the building without either going through the mountain, or taking a really long time. </p>
  
  <p>I am needing a snippet of code that allows my car to stay and travel on the ground, or to tilt the correct angle and travel up the mountain successfully. </p>
  
  <p>This is my code so far:</p>
  
  <pre><code>var speed : float = 10.0;
  var rotationSpeed : float = 100.0;
  function Update () {
  var translation : float = Input.GetAxis ("Vertical") * speed;
  var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
  translation *= Time.deltaTime;
  rotation *= Time.deltaTime;
  transform.Translate (0, 0, translation);
  transform.Rotate (0, rotation, 0);
  }
  function OnTriggerExit (other : Collider) {
  if (other.gameObject.CompareTag ("Road")) {
      speed = 20;
      rotationSpeed = 200;
      }
  }
  function OnTriggerEnter (other : Collider) {
  if (other.gameObject.CompareTag ("Road")) {
      speed = 75;
      rotationspeed = 750;
      }
  }
  </code></pre>