måndag 2 mars 2015

Watching them Eat

The final major day of our project workload.

The radius of the models now corresponds to the radius of the planet it's representing, and the collisions looks much better as a result.

Collisions may now result in one planet absorbing the other, if the smaller planet isn't moving away fast enough. We are still using elastic collisions to decide the resulting velocities, because they look more fun. The remaining planet will have the combined mass and volume of both and the velocity is determined by the preservation of momentum.

We also added camera control to the user, the camera will fixate on a planet (for now the sun) and the player can zoom and rotate around it in 3d space. We would like to add functionallity for switching fixated planet.

As a final feature the planet that the camera is fixated on (the sun) will now accelerate in the direction of the camera facing when the player holds down the space bar.
This combined with the eating of other planets introduces gameplay, where the player can attempt to devour other planets in the system.




torsdag 26 februari 2015

Collisions!

Guess we forgot to mention in the initial post that we're making this in unity.

Well, there it happened.

Now - as the title implies - we've decided to add collision detection and handling to the simulation.
This would of course be mostly unnecessary if we had it in a realistic simulation of the solar system, as any objects that would collide within a computable timeframe would be too small to include.
The first type of collision we'll model is elastic collision, as it's more predictable.

But simple tinkering and adding of a few new planets can yield some interesting results.

Gif of the first collision.

After adding some new planets the simulation slowed down (naturally) and we did some simple code optimizations.

While the above picture looks pretty neat, on closer inspection one might find it a bit unrealistic (even if one considers planets as billiard balls). This became much more apparent when a planet collided with the sun at an angle. The reason for this was that the code didn't take multiple dimensions into account. It simply assumed the two objects moved in one dimension (on the same line).

The solution we used was to simply let the projection of the velocity vectors on the line connecting the center of the two planets (one dimension) and let them collide, and replace the projected components of the velocity vectors with the results.

Gif of updated collision.

måndag 23 februari 2015

Hello universe

This is a project by Martin Mützell, Jesper Simonsson and Janne Selkälä for the course "Models and Simulations" held by CSC school at the Royal Institute of Technology in Stockholm.

We have until the fourth of March to finish this, so time is of course very limited.

Alright, so with the timeframe in mind we've decided to (as the title implies) build a simulation of our solar system, as there are numerous examples to draw from and one of the labs the course provided can easily be expanded into this.

We'll start with simulating the actual solar system to a reasonable degree.

The standard simulation with all the planets


This is the simulation after earth has been mixed with.