title: C# Vector to Quaternion Rotation Issue
body: <p>I've got a fairly intricate issue. Essentially, I've got an object that tracks a players position, using a LOS algorithm to always fly towards the players current position.</p>
  
  <p>I'm having an issue however, as I'm trying to get the object to shoot bullets in the direction of the player. The object uses pure vector mathematics to move towards the player, but considering how my functions operate, the bullets need to use quaternions.</p>
  
  <p>So, if an object moves towards a player, how can I make a Quaternion rotation that can be used by the bullet function to create bullets that also move towards the player with their source being the object?</p>
  
  <p><strong>My function to draw the object that follows the player:</strong></p>
  
  <pre><code>private void drawEnemy(GameTime gameTime)
  {
      angle += 0.1f;
  
      velocity = Vector3.Normalize(xwingPosition - enemyPos) * 0.02f;
  
      enemyPos = enemyPos + velocity;
      enemyWorldMatrix = Matrix.CreateRotationY(angle) * Matrix.CreateTranslation(enemyPos);
      DrawObject(enemy, enemyWorldMatrix, viewMatrix, projectionMatrix);
  
      //enemyRotation = GetRotation(xwingPosition, enemyPos);
  
      //Quaternion additionalRot = Quaternion.CreateFromAxisAngle(new Vector3(0, -1, 0), -0.1f) * Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), -0.1f);
      //enemyRotation *= additionalRot;
  
      double currentTime = gameTime.TotalGameTime.TotalMilliseconds;
      if (currentTime - enemyLastBulletTime &gt; 1000)
      {
          EnemyBullet newBullet = new EnemyBullet();
          newBullet.position = new Vector3(enemyPos.X + 0.2f, 71, enemyPos.Z + 0.2f);
          newBullet.t = 0.01f;
          newBullet.proportion = newBullet.t / 120;
          newBullet.playerPosition = xwingPosition;
          newBullet.enemyPosition = enemyPos;
          newBullet.currentAccel = 0.025f;
          enemyBulletList.Add(newBullet);
  
          enemyLastBulletTime = currentTime;
      }
  }
  </code></pre>
  
  <p>As you can see, it uses vector maths to track and move towards the player.</p>
  
  <p>As you can see, I'm trying to create bullets. The bullets use a Quaternion rotation that I'm hoping I created correctly.</p>
  
  <p>My <strong>function to update the positions of the bullets</strong> once they are created from the first function I wrote.</p>
  
  <pre><code>private void UpdateEnemyBulletPositions()
  {
      for (int i = 0; i &lt; enemyBulletList.Count; i++)
      {
          EnemyBullet currentBullet = enemyBulletList[i];
          currentBullet.t += 0.01f;
          currentBullet.position = enemyPos + (Vector3.Normalize(currentBullet.playerPosition - currentBullet.enemyPosition) * currentBullet.proportion);
          MoveForward(ref currentBullet.position, currentBullet.rotation, 0.04f + (currentBullet.currentAccel));
          enemyBulletList[i] = currentBullet;
  
          BoundingSphere bulletSphere = new BoundingSphere(currentBullet.position, 0.05f);
          CollisionType colType = CheckCollision(bulletSphere);
          if (colType != CollisionType.None)
          {
              enemyBulletList.RemoveAt(i);
              i--;
  
              if (colType == CollisionType.Target)
                  gameSpeed *= 1.05f;
          }
      }
  }
  </code></pre>
  
  <p><em>xwingPosition</em> is the players current position.</p>
  
  <p><em>enemyPos</em> is the current position of the object that follows the player</p>
  
  <p><strong>The issue is shown in this youtube clip which Im just preparing...</strong></p>
  
  <p><a href="http://www.youtube.com/watch?v=PnkCVKdfN9Y" rel="nofollow">http://www.youtube.com/watch?v=PnkCVKdfN9Y</a></p>
  
  <p>I think the problem lies with setting t to the total elapsed milliseconds rather than a counter starting from 0. Thing is, I don't know how to start a counter from 0 each time a bullet is made.</p>