Planetary rotations and revolutions in Unity

———————————————————–

Work on Caelium is finally under way, but there will probably be only gradual progress. I implemented a system where celestial bodies can orbit around other celestial bodies and also a system where the bodies rotate on their axis.

To do this, two rotations were required: axial (around its axis) and orbital (around another body).  In Unity, when I tried to apply both types of rotations on a body (as a single GameObject), only the orbital rotation seemed to work.

To fix this problem, I had a simple GameObject hierarchy. You start with a CelestialAnchor, which is basically a point in space that orbits around another CelestialAnchor. It’s responsible for the position of the planet/star/moon and its orbital rotation.

Each CelestialAnchor holds a CelestialBody, which contains the 3D model of the planet/star/moon and does the axial rotation.

In this hierarchy, the planets have an orbital and axial rotation applied, as seen in the video. The speed of the rotations and the distances between the bodies can be tweaked in the editor.

Rotating, Panning, and Zooming a Camera in Unity

————————————————

Link to code on bottom of post. ↓

————————————————

In Caelium, one of the features I wanted was simple camera movement system that could rotate the camera, pan it on the plane defined by its forward direction, and zoom. In the video, I demonstrate the movement of a camera in Unity.

To rotate the camera, you left click the mouse and move around. To pan the camera, you right-click the mouse and move around. To zoom, you middle click the mouse and move up or down.

By no means is it perfect, but what I have now is pretty good, as you can see in the video. I’ll explain how the movements work.

Continue reading

The idea behind Caelium

Caelium was a wondrous idea for interactive software that came about by love for astronomy and love for games where you build things. The most famous example of such a game is SimCity, where you build a city. However, I imagined Caelium having  a different scope in terms of complexity.

In Caelium you build a planetary system of your wildest dreams. You start with a star in the center and from there you make planets, moons, rings, and so on. I imagined that there would be a lot of customization in terms of types of planets, size of the star, number comets, and the list goes on and on. The problem is that giving too many options will make this space building experience very complicated, maybe even more than SimCity.

My intention with Caelium is to allow users to create planetary systems in a simple and easy to use interface. There are apps on iOS that helped inspire my idea of the “user-friendliness” I intend with Caelium. Check out Planetary and Starscape to know what I’m talking about. Those 2 apps are the main inspiration for this idea.

I’m still currently in the process of planning out what this ‘game’ will be like. I’m also experimenting with a prototype in Unity to see how to program planetary movement.

Moved Yxi from GameSalad to Game Maker Studio

The choice for GameSalad to make a game might sound strange, since I’m a programmer student and GameSalad has no coding. The story behind that is a little long, but I’ll explain anyway:

On October 19, 2012, two people from Microsoft came to DePaul’s College of Computing to talk about app development for Windows 8. They setup a workshop for people to make a Window 8 compatible game using GameSalad. I think the choice for GameSalad has something to do with how it currently supports export for Windows 8.

Considering how simple (perhaps too simple) GameSalad is, I wanted to make a game that was also simple. Unfortunately, GameSalad wasn’t delivering what I wanted. It doesn’t support sophisticated logic, nor does it support a changeable sprite anchor point.

Long story short, I started a new project with Game Maker Studio and reproduced every feature that was in my Yxi prototype from GameSalad. I even added a nice debug display you can toggle (see the screenshot).

Yxi Prototype in Game Maker

Yxi Prototype in Game Maker