Took me days to figure out how to do this. Hope it helps people make space games.
If you use this code please credit me, but you don’t have to ask me first.