title: Calculating Velocity Between Two Points
body: <p>I have an enemy ship and a player ship.</p>
  
  <p>I would like the enemy ship to always fly towards the player in a direct line, at all times, even when the player is moving.</p>
  
  <p>I'm going about this using the Ray class for C# XNA.</p>
  
  <p>I have two vector coordinates, the position/origin of the ray (the players current position), and the Direction of the ray (the enemy's current position). I'd like the enemy's position to gradually move towards the players position.</p>
  
  <p>I have this code so far.</p>
  
  <pre><code>enemyPlayerTrack.Position = playerPos;
  enemyPlayerTrack.Direction = enemyPos;
  </code></pre>
  
  <p>I'm unsure whether I need another vector for velocity or not.</p>
  
  <p>In the end, the enemy will be drawn to the screen with a new position with this code:</p>
  
  <pre><code>enemyWorldMatrix = Matrix.CreateTranslation(new Vector3(x, y, z));
  </code></pre>
  
  <p>Without a mathematical background, I'm having trouble creating a velocity to bridge the two vectors closer and closer.</p>