title: Unable to change rotation in Unity3D
body: <p>I've been working on a project in Unity3D and found a javascript that makes the enemies follow the player. This is the script:</p>
  
  <pre><code>var target : Transform; //the enemy's target
  var moveSpeed = 3; //move speed
  var rotationSpeed = 3; //speed of turning
  
  var myTransform : Transform; //current transform data of this enemy
  
  function Awake()
  {
      myTransform = transform; //cache transform data for easy access/preformance
  }
  
  function Start()
  {
       target = GameObject.FindWithTag("Player").transform; //target the player
  
  }
  
  function Update () {
      //rotate to look at the player
      myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
      Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
  
      //move towards the player
      myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
  
  
  }
  </code></pre>
  
  <p>When the enemies "rotate to look at the player" they rotate from a horizontal position to a vertical. How can I change the script in order to prevent that from happening?</p>