I made a movement like that! Instead of my math skills i used my very well developed work-around skills! I gave the spaceship an image point in the front, and added force towards that point of itself!
Have a look in the .cap! you might find other useful things!