Tracking an object such as a spaceship

To move from point (X1, Y1) to point (X2, Y2) in a straight line, most people use the Bresenham line algorithm.

There are 3D versions.