# Celestia/Tutorials/Moons

In Celestia, just as it is possible to add planets, asteroids, and comets in orbit around stars, it is possible to put moons around those objects, and even moons on those moons! This tutorial will show you how.
This tutorial assumes you have read the previous page: Simple Asteroids.

## Basic definition

We'll go through the parameters one by one. The definition looks very similar to the one given in the Simple Asteroids page, but there are some crucial differences that should be noticed.
Also, at any point you can add a comment to your .ssc code. A comment is started by a # sign and lasts until the next line break. It's a good idea to add comments explaining if you calculated parameters yourself, or if they are guesses.

## List of parameters

Generally speaking, most parameters for moons are the same as the ones in asteroids. For the mesh, texture, radius, color, albedo, and rotation, they are the same, so refer to that page for more information. Listed below are the differences.

### Names

This is similar to the definition in asteroids. Here, Sol/Parent Body just means to put the moon in orbit around some "Parent Body", which in turn orbits "Sol" (the Sun). This hierarchy can extend indefinitely: for the moon of a moon, or a sub-satellite, it would look like this:
Where "Name" orbits "Parent Body", which orbits "Parent Body 2", which orbits "Sol".

### Class

Celestia has two SSC object class for moons: moon and minormoon. They are pretty self-explanatory: moon should be used for the major moons of an object, while minormoon should be used for the minor moons. Minor moons are small, usually irregular, and may have eccentric and/or inclined orbits. Newly discovered moons are generally minor moons; all of the major moons have already been added in the default version of Celestia.

### Orbit

This bit of code defines how the moon orbits the parent body. Other parameters may be used, such as PericenterDistance, but this is the most common format. The key difference from objects orbiting stars (such as the Sun) is that for moons, the unit for SemiMajorAxis is in kilometers, not astronomical units.

## Definition using barycenters

For many minor planets, such as Pluto, their moons are so large relative to the parent body that the common center of mass (the barycenter) is outside of the parent body. For these objects, a special method has to be used so that the two bodies orbit their barycenter.
Here is some sample code:

## List of parameters (for using barycenters)

Again, most parameters for moons are the same as the ones in asteroids. For the mesh, texture, radius, color, albedo, and rotation, they are the same, so refer to that page for more information. Listed below are the differences.

### ReferencePoint

Putting "ReferencePoint" before the name of the object in a SSC file will turn said object into a point that other objects can orbit.

### Clickable and Visible

These are boolean parameters, meaning they can be either be set to true or false. If Visible is set to true, then the ReferencePoint's label will be visible. Clickable is set to true, then the ReferencePoint will be selectable, just like any other object.

### Setting the correct orbital frame

In the above code, you'll notice that the object "Name" looks like it orbits "Sol", even though in reality it orbits "Barycenter" which orbits "Sol". So how do we get it to orbit the "Barycenter" object?
By setting the correct OrbitFrame. In the code below, we tell Celestia to put "Name" in orbit around the Barycenter.
Be very careful when picking the correct orbital frame. Here, it is set to "EquatorJ2000", which means that the orbital elements are in an equatorial frame. If you are pulling elements from a paper, check to see if the orbital frame is in the equatorial (EQJ2000) or ecliptic (ECJ2000) frame. If it says ecliptic, use this code instead:
If the orbital frame has a center that is "Something/Something", then the units of Period will be days, not years, and the units of SemiMajorAxis will be kilometers, not astronomical units.