Press "s" to speed up time (i.e. fewer waypoints are calculated) Press "d" to slow down time (i.e. more waypoints are calculated)
This simulation shows how the slingshot effect works. The asteroid has 50x the mass of the spaceship. The total momentum of spaceship plus asteroid is shown as mx, my. It always remains the same. To demonstrate a slingshot effect, the rocket has to exit with greater velocity than it enters. The change in rocket momentum must be exactly cancelled by the change in asteroid momentum. In the first test, the asteroid begins with zero velocity. The rocket actually slows down as a result of the flyby. This is because the asteroid soaks up some of the rocket's energy. In the second test, the asteroid is moving in a direction such that, as a result of the flyby, it is slowed down. The kinetic energy lost by the asteroid is taken up by the rocket. This is the slingshot effect.