I am currently writing a game where you fly a starship in 2D space. In a given timestep, the ship has the ability to accelerate at constant rate in any direction. The player can specify a point at which the ship should move to, and the ship should do its best to move to that point.
The way I'm currently calculating the acceleration vector direction in a given timestep is by subtracting the target position from the ship's current position. This is well and good for travelling from rest to the first point. However, after the ship has already built up a reasonable velocity and I specify a new target (say, at a point perpendicular to the ship's current velocity vector), the ship has trouble navigating there and will often just run in circles around the target point.
So, the question is, given some initial ship velocity vector (Vs) and initial ship point (Ps) in 2D space, how do I calculate the direction of the acceleration vector in order to most quickly reach a target point (Pt)? I have been using Pt - Ps normalized, but that just results in the ship going in circles after it has a good initial velocity.
I can't quite wrap my head around how to do it. It almost seems like you must have to do some calculations over multiple timesteps or something.