NASA SPICE Library Integration on Android
Working packaged builds on Mobile VR devices
Hello friends,
I wanted to share a massive win that I managed to a achieve about a month ago with regards to my Space Simulator project. Originally I was using a simple but fleshed out plugin to create orbits and large scale distances, but realized certain inherent limitations of it once I was attempted to do a Hohmann Transfer style maneuver, it unfortunately seems it did not handle shifting gravitational bodies while maintaining velocity vectors very well and had me struggling to find a solution.
This was the point where I decided I was at a cross-roads in my development: do I continue forward with this path or do I try and integrate Chuck Noble’s work with the MaxQ plugin into my project which would be a lot of starting over but also have some pros/cons. The biggest pro is that it utilizes the official NASA SPICE toolkit and library and references ephemeris data, meaning I can represent real world scales and positions, however it also means these only get set at runtime and it is much more challenging to use with an absolutely massive learning curve. I decided to explore it and see where it went.
Turns out I don’t regret that decision, it took a while to get up and running, starting with very simplistic demo content and going from there. I am using Unreal 5.4 and the plugin wasn’t meant for that yet, I was able to recompile it to make it compatible, making it useable. The biggest challenge, however, was getting SPICE to work on Android: my target platform is mobile VR, specifically the Meta Quest device to start for reasons I will elaborate on later but something I am hard about, and SPICE was originally written in Fortran with C hooks and only ever designed to work on PC. Packaging onto a Quest would lead to hard crashes and endless errors. It took about 3 weeks of noodling to learn how to recompile the library and kernels so that it could be read properly on AARM Architecture, but finally I was successful, learning a plethora or new skills along the way and doing things I had never done before. The result is encapsulated in this video below:
There are still some technical hurdles, like packaging kernels of data into the APK and installing them into the right external directories on the HMD at runtime, getting closer but at least I know it’s solvable.
The wins of this show promise to outweigh the cons and because of this I’ve decided to continue pushing forward in this direction, it does involve a lot of rework and building things from scratch, but I will explain in the next update.



Nice work, Dylan!