Sometimes a web comic speaks to your soul. The title comes from the hover text of this SMBC comic. At the time I was working on my third attempt to create code for a Lunar free-return trajectory and add it to gravity engine. With the release yesterday of Gravity Engine 3.2 there is now a passable effort at this somewhat difficult problem. It was important to me to get something working since several users were keen to include this in their games. The result allows mission planning for a patched conic “on-rails” trajectory that loops around the moon.
The mathematics behind the patched conic approximation is fairly straight-forward. It is often described in textbooks in the context of a mission to another planet.
The free-return problem adds a significant complication since the return path after lunar flyby needs to bring the spacecraft back to Earth and the path needs to impact the atmosphere to ensure re-entry. This adds an additional constraint to the motion that is already constrained by a desired time of flight to the moon and a specific perilune approach target. The scene created for Gravity Engine 3.2 allows this to be explored interactively. Doing this you discover it is a very difficult to meet all three goals and this is the “simplified” version of the problem using patched conics!
This scene is a step in the right direction but I still find it a bit disappointing. I want Gravity Engine to move in the direction of a tool that allows game developers to just “Make It So”. I want a system where the desired free-return attributes are given and the code can do the astro version of “path finding” to make it happen.
Gravity Engine 3.2 is now live on the Unity Asset store. The details of how the free-return scene works are here.