Mathematical Orrery

A maths-for-games artefact simulating the Milky Way solar system, including nine planets and their major moons. The project focused on building a custom maths library and applying concepts such as vectors, matrices, quaternions, and Euler angles to calculate planetary orbits, transformations, and camera movement.

  • Planetary Simulation & Camera System

    The simulation features nine planets and their moons orbiting around a scalable sun. To make the system explorable, I implemented two camera perspectives: a static overhead view and a first-person camera that can be controlled with WASD input. The first-person camera made use of Euler angles and custom vectors from my maths library to handle rotation and movement. A switching system allowed the player to move seamlessly between the two perspectives, making it easier to observe the orbits both as a whole and from within the system itself.

  • Programming & Maths Implementation

    The project required a custom maths library, which I built to include vectors, 4×4 matrices, trigonometry functions, and quaternions. I created a generalised transform function that could apply scale, rotation, and translation to objects in a single step, which became essential for calculating planetary orbits. Each planet used the same script, made editable in the Unity inspector through the use of [System.Serializable], which allowed me to efficiently customise parameters for each body. Planets orbited the sun using quaternions and modified vector rotation formulas taken from lecture material, while moons reused the same system with added retrograde functionality and bug fixes. Together, these elements formed a modular and reusable framework for the entire simulation.

  • Scale & Customisation Options

    A significant issue in creating the simulation was how to represent scale accurately while keeping the system observable. Real-world distances made the planets far too small and spread apart to be useful for demonstration. To address this, I created a toggle system that allowed switching between a to-scale model and a non-scaled, customisable version. I also included a slider to control the speed of the simulation, achieved by multiplying a global time variable across the system. Every planet and moon was linked to a central controller object, which handled orbit calculations and transforms, ensuring the entire simulation could be adjusted efficiently from a single script.

  • Challenges & Problem Solving

    One of the largest challenges in the project was resolving scaling issues. My first attempt was to multiply real-world values down, but this caused planets to either disappear or remain unreasonably far apart. The final solution was to include a toggle between scale and non-scale models, combined with manually editable values for planet sizes when not to scale. Another issue arose when calculating planetary distances: by basing positions on object centres, planets overlapped. This was corrected by accounting for radii in the distance calculations. I also considered implementing a line-trace system for planet selection but was unable to do so within the timeframe given for this project.