Space Simulation With Meteors

By Danielle Moreno

Idea

A space simulation with the ability to launch meteors to disturb planets in the system. Inspiration was taken from other space simulator games like Universe Sandbox.

Main Features

OpenGL Features

The Solar Sytem

Solar System going brrrr

The solar system is made from a modified version of the galaxy simulation lab with a central star and 1000 orbitting particles. A modified version of the circular orbit formula from the lab is used to create the orbit of each planet in the system. The sun is always set to zero so the systems does not get disturbed.

The Meteors

Meteors are created when the user presses the e key and are shot in the direction the camera is facing. They use the same class as a particle but have a modification that tracks their inital velocity and collision effect based on the user's input.

Meteors being shot at solar system

Meteors Types:

Zero Velocity
No intial velocity when created, meteor is only affected by Sun's gravity
Low Velocity
Low intial velocty when created
High Velocity
High intial velocity when created
"Eraser" Effect
Very high collision constant that causes collided particles to "disappear"
Low Collision Effect
Low collision constant that creates slow moving particles when meteor collides into them
High Collision Effect
High collision constant that creates fast moving particles when meteor collides into them

Full List of Meteors in Simulation:

  • Zero Velocity, Eraser Effect
  • Zero Velocity, Low Collision Effect
  • Zero Velocity, High Collision Effect
  • Low Velocity, Eraser Effect
  • Low Velocity, Low Collision Effect
  • Low Velocity, High Collision Effect
  • High Velocity, Eraser Effect
  • High Velocity, Low Collision Effect
  • High Velocity, High Collision Effect

User Input

The user can rotate the camera by clicking and dragging their mouse across the screen
holding CTRL - zooms camera in/out
holding SHIFT - moves camera's position

Meteor Controls:

e - shoot a meteor in the direction the camera is facing
h - toggle HUD showing current meteor selected
v - change current initial velocity used by meteor
b - change current collision effect used by meteor

Gravity Simulation

Example from galaxy Simulation Lab

Using the galaxy simulation lab, I was able to create my own solar system that I could launch meteors at. The gravtiy formulas were used in this project from the lab, but were modified so gravity was calculated between the main star and all it's surrounding planets to reduce computation needed for the simulation. The Sun's position is also not changed by forces acting upon it to make using the simulation easier for the user. Meteors are also affected by the Sun's gravity but not by other planets' gravities.

Collisions

Example from Cloth Simulation

Collisions are detected between meteors and planets in the solar system. Collisions are detected using the smae techniques the cloth simulation lab used with a modified collision constant to create better collision effects. The constant can be modified using the b key. Collisions do not happen between the Sun and meteors or meteors and meteors to prevent weird behavior from happening.

Direction Rays

Example from Ray Intersections Lab

A meteor is shot starting at the position of the camera in the direction the camera is currently facing. To effectively do this in my project, I used code from the ray intersections lab to create a ray from the camera in a direction starting from the camera to the mouse that the meteor will follow. Meteors are then intialized using a set intial velocity with the direction ray.

Resources