writing an autopilot for a 2d game with newtonian physics
- by Jargo
The subject says it all. I am making a 2d space game with newtonian physics and I need pointers on how to write an autopilot for it. The requirements are best explained by an example.
There is a target object which has speed- and position-vectors and there a spaceship that is controlled by the autopilot. This spaceship also have speed, position and maximum acceleration. The autopilot needs to control the ship that it either collides with the target, Or intercepts the target so that the ship has matching speed and position with the target.
Could someone give me some pointers how to achieve this behavior or perhaps even an ready implementation? I am sure someone has written something like this before and there is no point in reinventing the wheel.